Can I ask why you are using a c string to pass the file name?

I also don't see any destructors, so I'm guessing that your program leaks memory.