.TH FREAD 3S .SH NAME fread, fwrite \- buffered binary input/output .SH SYNOPSIS .B #include .PP .B fread(ptr, sizeof(*ptr), nitems, stream) .br .SM .B FILE .B *stream; .PP .B fwrite(ptr, sizeof(*ptr), nitems, stream) .br .SM .B FILE .B *stream; .SH DESCRIPTION .I Fread reads, into a block beginning at .I ptr, .I nitems of data of the type of .I *ptr from the named input .IR stream . It returns the number of items actually read. .PP .I Fwrite appends at most .I nitems of data of the type of .I *ptr beginning at .I ptr to the named output .IR stream . It returns the number of items actually written. .SH "SEE ALSO" read(2), write(2), fopen(3), getc(3), putc(3), gets(3), puts(3), printf(3), scanf(3) .SH DIAGNOSTICS .I Fread and .I fwrite return 0 upon end of file or error.