.TH FREAD 3S "19 January 1983" .UC 4 .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 .IR 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 If .I stream is .B stdin and the standard output is line buffered, then any partial output line will be flushed before any call to .IR read (2) to satisfy the .IR fread . .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(3S), getc(3S), putc(3S), gets(3S), puts(3S), printf(3S), scanf(3S) .SH DIAGNOSTICS .I Fread and .I fwrite return 0 upon end of file or error.