NAME

zkFread - binary input

SYNOPSIS

#include "zkStdio.h"

size_t zkFread(void* ptr, size_t size, size_t nitems, FILE* stream);

DESCRIPTION

The zkFread() function reads, into the array pointed to by ptr, up to nitems members whose size is specified by size in bytes, from the stream pointed to by stream. The file position indicator for the stream (if defined) is advanced by the number of bytes successfully read. If an error occurs, the resulting value of the file position indicator for the stream is indeterminate. If a partial member is read, its value is indeterminate.

RETURN VALUE

Upon successful completion, zkFread() returns the number of members successfully read which is less than nitems only if a read error or end-of-file is encountered. If size or nitems is 0, zkFread() returns 0 and the contents of the array and the state of the stream remain unchanged. Otherwise, if a read error occurs, the error indicator for the stream is set and errno is set to indicate the error.

ERRORS

Refer to zkFgetc().

APPLICATION USAGE

The ferror() or feof() functions must be used to distinguish between an error condition and an end-of-file condition.

PORTABILITY

Because of possible differences in member length and byte ordering, files written using zkFwrite() are application-dependent, and possibly cannot be read using zkFread() by a different application or by the same application on a different processor.