I use fread to read a large chunk of image data (> 1 MB) from a file. I recently encountered a bug in MinGW with windows network resources where one call for fread as
fread(file, 4, 100000, data);
with a reliable error with the error "Invalid argument", but 10 calls
fread(file, 4, 10000, data); data += 10000;
succeed and give the right result. I conclude that there should be a maximum size for fread that I did not know about before. I split the allowed fread size and found that it is between 31000 and 32000 blocks of 4 bytes. Has anyone come across this before? Is this a bug in MinGW? Is there a way to determine the maximum "safe" size for fread?
source share