READ - read from a file.

(Compatible with UNIX System V C)

Usage:

#include <fildes.h>
ret = read( fd, buf, N );

Where:

int fd;
is the file descriptor of a file open for reading (as returned by "open" or "creat").
char *buf;
points to an area of memory into which the data should be read.
unsigned N;
is the maximum number of bytes to read.
int ret;
is the number of bytes actually read. If the operation failed, a -1 is returned and the library variable ERRNO is set to indicate the error (see "expl c lib errno").

Description:

"read" reads in data from the position indicated by the current file pointer associated with the given file descriptor.

Possible Errors:

errno=EBADF
"fd" was invalid.
errno=EINVAL
N was less than zero.
errno=EIO
an I/O error occurred.

Notes:

This function exists solely for compatibility with existing software. New programs should use the "fread" function instead.

You must #include <fildes.h>; otherwise, the reference to "read" will be resolved to a different, incompatible function.

See Also:

expl c lib open

expl c lib write

expl c include fildes

Copyright © 1996, Thinkage Ltd.