WRITE(2)
NAME
write − write on a file
SYNOPSIS
write(fildes, buffer, nbytes)
char *buffer;
DESCRIPTION
A file descriptor is a word returned from a successful open, creat, dup, or pipe(2) call.
Buffer is the address of nbytes contiguous bytes which are written on the output file. The number of characters actually written is returned. It should be regarded as an error if this is not the same as requested.
Writes which are multiples of 512 characters long and begin on a 512-byte boundary in the file are more efficient than any others.
DIAGNOSTICS
Write will fail if one or more of the following is true:
[EBADF] Fildes is not a valid descriptor open for writing.
[EFAULT] The specified address is odd or the count is odd when dealing with disk character special files.
[EFAULT] The buffer points to an address outside the process’s allocated address space.
[EFBIG] An attempt was made to write a file that exceeds the maximum file size.
[ENXIO] The specified /dev/mem address is illegal.
[EPIPE] An attempt is made to write to a pipe that is not open for reading by any process.
[EQUOT] An attempt was made to write a file that exceeds a quota governing the file.
[ETPL] The magtape tape position was lost or the tape went offline during a write.
SEE ALSO
ASSEMBLER
(write = 4.)
(file descriptor in r0)
sys write; buffer; nbytes
(byte count in r0)