READ(2)

NAME
read, write - read / write syscalls

SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
int read(int fildes, char *buf, off_t count);
int write(int fildes, const char *buf, off_t count);

DESCRIPTION
read() attempts to read count bytes from open file descriptor filedes , storing them in the memory location pointed to by buf write() works in the same fashion, only the bytes are written to the file descriptor. read and write() return the number of bytes successfully read from or written to the file descriptor, 0 on EOF, and a negative number on any other error condition.

ERRORS
0 is returned on EOF

-EBADF is returned when an invalid filedes was used, the file was opened read only and a write was attempted, or the file was opened write only and a read was attempted.

-EINVAL is returned when the i_mode field of the inode is invalid.

FILES
linux/fs/read_write.c
/usr/include/linux/sys.h
/usr/include/unistd.h

SEE ALSO
fread(3), fwrite(3)