COHERENT manpages

This page displays the COHERENT manpage for write() [Write to a file].

List of available manpages
Index


write() -- System Call (libc)

Write to a file
#include <unistd.h>
int write(fd, buffer, n)
int fd; char *buffer; int 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

libc,
unistd.h
POSIX Standard, §6.4.2

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.  Do not
use it with the STDIO routines fread(), fwrite(), fputs(), or fprintf().