What's new

32bit Windows fread 4GB limit

smcd

Active member
Is there a way to overcome the limitation of reading files > 4GB using fread on Windows? I suppose I could use CreateFile/ReadFile though it doesn't help since I'm trying to keep this as "standard" as possible, thus fread

Compiler: Visual C++ 2005. (I also tried with MinGW 3.4.2)
 

mudlord

Banned
AFAIK, there is none.

Only solution would be using 64bit processes, and that involves making your app 64-bit only.

Part of the issue is that the 32-bit fread implementation uses unsigned 32-bit types..Which means naturally, to bypass that, you need 64-bit implementations.
 
Last edited:

Cyberman

Moderator
Moderator
To get beyond it in windows you may need to do some nasty things.
Actually you need to create your own 64bit variants of fread fwrite and fseek
fseek you might start from this MS fun bit of crude

Win32 is partially the limitation it's actually MS's library.
fseek64(long long unsigned int) might be what you wish to create. I am not sure you want to make your own 64 bit streaming libraries or not. I don't know off hand how many extended libraries there are for VC++/ (VS 2005 .NET confusion).

Cyb
 

Top