FreadFwriteread/write binary data
#include <stdio.h>
freadchar *ptrint sizeint numberFILE *fpfwritechar *ptrint sizeint numberFILE *fpDescription
Fread reads from the file pointed to by "fp". "Number" is the
number of items of size "size" that are to be read starting at
"ptr". The best way to pass the argument "size" to fread is by
using "sizeof". Fread returns the number of items actually
read.
Fwrite writes to the file pointed to by "fp". "Number" is the
number of items of size "size" reading the from memory
starting at "ptr".
Diagnostics
Both functions return 0 (NULL) at the end of file or error.
See Also
System calls
read(),
write().
Fopen(),
getc(),
putc(),
printf().