Since I'm going to be handling large files it's a bad idea to allocate 700mb of memory. I'm more concerned why it's not opening the file.
Why doesn't fstream work?
There should be some configuration options in the compiler you are using to let the standard library do that.
It may be necessary to recompile your libstdc++ with large file support.
It was my understanding that VS 9.0+ was able to open large files.
But from what you post, your file is opening just fine.
You should be aware, however, that if your program is compiled in 32-bit mode that the file seek and tell functions cannot do anything useful for you, as a 32-bit size_t/ptrdiff_t is not capable of handling such a large file (and, as a result, invalidates some of the invariants that the standard applies to those types).
To get the full size of the file, you'll have to use some Windows API functions directly (specifically, FindFirstFile()), and look at the WIN32_FIND_DATA structure members nFileSizeHigh and nFileSizeLow.
The other option is to use Boost Filesystem, which I believe has LFS support enabled by default on systems that can do it...
you didn't specify what you will do with the data. i assumed you would want to manipulate it somehow. wouldn't you need to read it into memory in order to do something with it.
Ok i've read up the file section again (I guess I missed out key info...)
For ifstream and ofstream classes, ios::in and ios::out are automatically and respectively assumed, even if a mode that does not include them is passed as second argument to the open() member function.
The default value is only applied if the function is called without specifying any value for the mode parameter. If the function is called with any value in that parameter the default mode is overridden, not combined.
So when I specify fstream and then ios::binary it's overwritten not combined which is why it fails to open the file right? So that's why I have to include the in and out flags?