I/O, fread.
-
Hi, I have the following in my code:
#define SIZE 16384
while(buffer_len = fread(buffer, 1, SIZE, src))It works fine till the SIZE doesn't exceed 16K, but when i use 131072 for SIZE's value fread returns 0 on the first call, and it isn't eof. But while I debug it and use:
call fread(buffer, 1, 131072, src)
it returns 131072 and the buffer is OK. May be I'm missing some compilations flag? I'm using GNU gdb Red Hat Linux (6.3.0.0-1.143.el4rh) on Red Hat Enterprise Linux AS release 4 (Nahant Update 5) Thanks.
-
Hi, I have the following in my code:
#define SIZE 16384
while(buffer_len = fread(buffer, 1, SIZE, src))It works fine till the SIZE doesn't exceed 16K, but when i use 131072 for SIZE's value fread returns 0 on the first call, and it isn't eof. But while I debug it and use:
call fread(buffer, 1, 131072, src)
it returns 131072 and the buffer is OK. May be I'm missing some compilations flag? I'm using GNU gdb Red Hat Linux (6.3.0.0-1.143.el4rh) on Red Hat Enterprise Linux AS release 4 (Nahant Update 5) Thanks.
Evgeni57 wrote:
I'm using GNU gdb Red Hat Linux (6.3.0.0-1.143.el4rh) on Red Hat Enterprise Linux AS release 4 (Nahant
Why are you posting on the Visual C++ / MFC Forum then?
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition. Blaise Pascal
-
Hi, I have the following in my code:
#define SIZE 16384
while(buffer_len = fread(buffer, 1, SIZE, src))It works fine till the SIZE doesn't exceed 16K, but when i use 131072 for SIZE's value fread returns 0 on the first call, and it isn't eof. But while I debug it and use:
call fread(buffer, 1, 131072, src)
it returns 131072 and the buffer is OK. May be I'm missing some compilations flag? I'm using GNU gdb Red Hat Linux (6.3.0.0-1.143.el4rh) on Red Hat Enterprise Linux AS release 4 (Nahant Update 5) Thanks.
fread returns the number of full items actually read, which may be less than count if an error occurs or if the end of the file is encountered before reaching count. Use the feof or ferror function to distinguish a read error from an end-of-file condition. If size or count is 0, fread returns 0 and the buffer contents are unchanged.