The OpenD Programming Language

ReadProc

A function with same signature and semantics than fread.

Some details from the Linux man pages:

"On success, fread() and fwrite() return the number of items read or written. This number equals the number of bytes transferred only when size is 1. If an error occurs, or the end of the file is reached, the return value is a short item count (or zero).

The file position indicator for the stream is advanced by the number of bytes successfully read or written.

fread() does not distinguish between end-of-file and error, and callers must use feof() and ferror() to determine which occurred. (well, ferror not available in gamut).

import gamut.io;
extern (C) nothrow @nogc @system
alias ReadProc = size_t function
(
void* buffer
,
size_t size
,
size_t count
,)

Return Value

Number of item successfully read. If return value != count, there was an error.

Limitations: it is forbidden to ask more than 0x7fffffff bytes at once.

Meta