.TH READ 2 .SH NAME read, write \- read or write file .SH SYNOPSIS .B long read(int fd, void *buf, long nbytes) .PP .B long write(int fd, void *buf, long nbytes) .SH DESCRIPTION .I Read reads .I nbytes bytes of data from the offset in the file associated with .I fd into memory at .IR buf . The offset is advanced by the number of bytes read. It is not guaranteed that all .I nbytes bytes will be read; for example if the file refers to the console, at most one line will be returned. In any event the number of characters read is returned. A return value of 0 is conventionally interpreted as end of file. .PP .I Write writes .I nbytes bytes of data starting at .I buf to the file associated with .I fd at the file offset. The offset is advanced by the number of bytes written. The number of characters actually written is returned. It should be regarded as an error if this is not the same as requested. .SH SEE ALSO .IR intro (2), .IR open (2), .IR dup (2), .IR pipe (2) .SH DIAGNOSTICS These functions set .I errstr.