

write()                COHERENT System Call               write()




Write to a file

iinntt wwrriittee(_f_d, _b_u_f_f_e_r, _n)
iinntt _f_d; cchhaarr *_b_u_f_f_e_r; iinntt _n;

write writes  n bytes of data, beginning  at address buffer, into
the file associated  with the file descriptor fd.  Writing begins
at the current write position, as  set by the last call to either
write or lseek.  write  advances the position of the file pointer
by the number of characters written.

***** Example *****

For an  example of how  to use this  function, see the  entry for
open.

***** See Also *****

COHERENT system calls, STDIO

***** Diagnostics *****

write returns -1 if  an error occurred before the write operation
commenced, such  as a  bad file  descriptor fd or  invalid buffer
pointer.  Otherwise, it  returns the number of bytes written.  It
should be considered  an error if this number is  not the same as
n.

***** Notes *****

write is a low-level  call that passes data directly to COHERENT.
It  should not  be mixed  with high-level  calls, such  as fread,
fwrite, or fopen.























COHERENT Lexicon                                           Page 1


