
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Telix/SALT v3.15 & RS-232, Hayes - <b>fread</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
FREAD
. Summary
fread(str <buf>, int <count>, int <fh>);
. Description
The fread function reads up to <count> bytes from the file repre-
sented by file handle <fh>. Characters are written to the <buf>
variable, which must be large enough.
. Return Value
The number of bytes actually read is returned, which may be less
than <count> if an error occurs or and end-of-file is encountered.
The ferror and feof functions should be used to distinguish an error
from an end-of-file condition.
. Example
int f;
str buffer[40];
f = fopen("test.dat", "r");
fseek(f, 1000, 0); // goto offset 1000 in file
fread(buffer, 40, f); // and read 40 bytes of data
See Also: ferror feof fopen fclose fwrite fgets fputs fgetc
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson