Reputation: 2225
I am writing a c++ program to read/write a large file (probably larger than 60GB). By googling the problem, it seems that there is a 2GB limit on file io in 32 bit system (I am using windows 7 64bit but my program was compiled with mingw32). In my program, I am writing 10 integers at a time to the file and all these numbers are generated randomly based on some algorithm. It seems that the program can run even when the file size bigger than 40GB but there is no way for me to check if the data read by the program is really the one stored in the file or some junk numbers. But anyway, the program doesn't report any warning or error. Is this really possible to read/write file larger than 60GB in a 32-bit program?
Upvotes: 7
Views: 3017
Reputation: 26409
There's a limit on file size (4GB max, I think) on Fat32 file system. Windows 7 definitely shouldn't be using that filesystem by default.
Also on 32bit system there's a limit on the file size you can map into memory at once using CreateFileMapping/MapViewOfFile. However, fstream doesn't use CreateFileMapping/MapViewOfFile internally, so there's no limit for file size (aside from filesystem limits). And even with CreateFileMapping you can map portion of larger file into memory, so there's no limit aside from the one imposed by filesystem.
Upvotes: 1