INtime SDK Help
read

Reads the specified number of bytes from a file into a buffer, beginning at the current position of the file pointer.

#include <io.h>

int read (int handle, char *buffer, unsigned int count);

Parameters

handle
Descriptor referring to an open file.
buffer
Storage location for data.
count
Maximum number of bytes to read.

Remarks

After the read operation, the file pointer points to the next unread character.

In text mode, each <CR><LF> pair is replaced with a single <LF> character. Only the single <LF> character is counted in the return value. The replacement does not affect the file pointer.

Return Values

The number of bytes actually read, usually count. Less than count if there are fewer than count bytes left in the file, or if the file was opened in text mode.
Success.
Returns one of these:
  • 0 (zero) indicates an attempt to read at end-of-file.
  • -1 indicates an error, and the function sets errno to EBADF, indicating that the given descriptor is invalid, the file is not open for reading, or the file is locked.
Failure.

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/io.h io.h clib.lib

See Also

creat, fread, write