Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
fread
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The fread function reads up to <count> items, of <size> bytes
each, from the input <stream> and stores them in <buffer>. The
file pointer associated with <stream> (if there is one) is
increased by the number of bytes actually read.
If the given stream is opened in text mode, carriage-return──
line-feed pairs are replaced with single line-feed characters. The
replacement has no effect on the file pointer or the return value.
If an error occurs, both the file-pointer position and the value
of a partially read item are indeterminate.
Return Value
The fread function returns the number of full items actually read,
which may be less than <count> if an error occurs or if end-of-
file is encountered before reaching <count>.
The feof or ferror function should be used 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.
-♦-