WRITE(2) WRITE(2) NAME write - write on a file SYNOPSIS write(fildes, buffer, nbytes) char *buffer; DESCRIPTION Write writes data on the open file associated with the file descriptor. Buffer is the address of nbytes contiguous bytes which are written on the output file. The number of characters actu- ally written is returned. It should be regarded as an error if this is not the same as requested. If the open file is being read by another process, data of at most one write will be delivered to any read(2) in the other process. In particular, if nbytes = 0, the read will return a count of 0, which is conventionally taken to mean end of file. Writes which are synchronized with file system blocks are more efficient than others; see filsys(5). On some systems write clears the set-user-id bit on a file. This prevents penetration of system security by a user who captures a writable set-user-id file that he does not own. SEE ALSO creat(2), open(2), pipe(2), select(2) DIAGNOSTICS Returns -1 on error: bad descriptor, buffer address, or count; physical I/O errors.