Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

fread(3) Guardian Native C Library Calls Reference Manual
NAME
fread - Reads input from a stream
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <stdio.h>
size_t fread(
void pointer,
size_t size,
size_t num_items,
FILE stream);
PARAMETERS
pointer Points to an array.
size Specifies the size of the variable type of the array pointed to by the pointer
parameter.
num_items Specifies the number of items of data.
stream Species the input output stream.
DESCRIPTION
The fread() function copies num_items of data of length size from the input stream into an array
beginning at the location pointed to by the pointer parameter.
The fread() function stops copying bytes if an End-of-File or error condition is encountered
while reading from the input specified by the stream parameter, or when the number of data items
specified by the num_items parameter have been copied. It leaves the file pointer of the stream
parameter, if dened, pointing to the byte following the last byte read, if there is one. The
fread() function does not change the contents of the stream parameter.
NOTES
If the stream parameter is invalid, the result of calling the fread() function is undefined.
RETURN VALUES
Upon successful completion, the fread() function returns the number of items actually
transferred. If the num_items parameter is negative or 0 (zero), no characters are transferred, and
a value of 0 (zero) is returned. If a read error occurs, the error indicator for the stream is set, and
errno is set to indicate the error.
ERRORS
The fread() function fails if:
The stream parameter is not open for reading.
The stream is unbuffered.
The streams buffer needed to be flushed and the function call caused an underlying
write() or lseek() to be invoked and this underlying operation fails.
In addition, if any of the following conditions occur, the fread() function sets errno to the
corresponding value:
2106 Hewlett-Packard Company 527192-018