WRITE - write to file.

(Compatible with UNIX C)

Usage:

#include <fildes.h>
ret = write( fd, buf, N );

Where:

int fd;
is the file descriptor of a file open for writing (as returned by "open" or "creat").
char *buf;
points to an area of memory from which the data should be written.
unsigned N;
is the number of bytes to write.
int ret;
is the number of bytes actually written. If the operation failed, a -1 is returned and "errno" is set to indicate the error (see below).

Description:

"write" writes out data onto a file, beginning at the position indicated by the current file pointer associated with the given file descriptor.

Possible Errors:

errno=EBADF
"fd" was invalid.
errno=EINVAL
N was less than zero.
errno=EIO
an I/O error occurred.

Notes:

This function exists solely for compatibility with existing software. New programs should use the "fwrite" function instead.

See Also:

expl c lib open

expl c lib read

expl c include fildes

Copyright © 1996, Thinkage Ltd.