Function WRITE

Syntax:

write file-descriptor vector &key(start 0) (end nil) => effective-count

Arguments and values:

file-descriptor -- A non-negative integer.

vector -- A vector with element-type (unsigned-byte 8).

effective-count -- A non-negative integer.

start, end -- Bounding index designators of vector.

Description:

write writes up to count bytes from the interval in vector designated by start and end to the file referred to by file-descriptor.

The number of bytes written may be less than count if, for example, there is insufficient space on the underlying physical medium, or the +rlimit-fsize+ resource limit is encountered (see setrlimit), or the call was interrupted by a signal handler after having written less than count bytes.

For a seekable file (i.e., one to which lseek may be applied, for example, a regular file) writing takes place at the current file offset, and the file offset is incremented by the number of bytes actually written. If the file was open(2)ed with O_APPEND, the file offset is first set to the end of the file before writing. The adjustment of the file offset and the write operation are performed as an atomic step.

POSIX requires that a read which can be proved to occur after a write has returned returns the new data. Note that not all file systems are POSIX conforming.

Errors:

If file-descriptor is not a valid file descriptor, or not open for writing, the condition invalid-file-descriptor is signaled.