RTEMS Logo

RTEMS 4.10.2 On-Line Library


Input and Output Primitives Manager read - Reads from a file

PREV UP NEXT Bookshelf RTEMS POSIX API User's Guide

5.4.5: read - Reads from a file

CALLING SEQUENCE:

#include <unistd.h>

int read(
  int           fildes,
  void         *buf,
  unsigned int  nbyte
);

STATUS CODES:

On error, this routine returns -1 and sets errno to one of the following:

EAGAIN
The O_NONBLOCK flag is set for a file descriptor and the process would be delayed in the I/O operation.
EBADF
Invalid file descriptor
EINTR
Function was interrupted by a signal.
EIO
Input or output error
EINVAL
Bad buffer pointer

DESCRIPTION:

The read() function reads nbyte bytes from the file associated with fildes into the buffer pointed to by buf.

The read() function returns the number of bytes actually read and placed in the buffer. This will be less than nbyte if:

When attempting to read from any empty pipe or FIFO:

When attempting to read from a file other than a pipe or FIFO and no data is available.

NOTES:

NONE


PREV UP NEXT Bookshelf RTEMS POSIX API User's Guide

Copyright © 1988-2008 OAR Corporation