write [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation
HP C/iX Library Reference Manual
write
Writes data to a file.
Syntax
int write (int fildes, char *buffer, unsigned nbyte);
Parameters
fildes The file descriptor of the file to write to.
buffer A pointer to a buffer containing data to write.
nbyte The number of bytes to write.
Return Values
>=0 The number of bytes written.
-1 An error occurred. The file position indicator remains
unchanged and errno is set to one of the following values:
EBADF The fildes parameter is not a valid file
descriptor open for writing.
EFBIG An attempt was made to write a file that
exceeds the process's file size limit or the
maximum file size.
ESYSERR A call to a system intrinsic failed.
Description
The write function writes nbyte bytes from the buffer pointed to by
buffer to the file associated with fildes.
On devices capable of seeking, the actual writing of data proceeds from
the position in the file indicated by the file position indicator. Upon
return from write(), the file position indicator is incremented by the
number of bytes actually written.
On devices incapable of seeking, writing always takes place starting at
the device's current position. The value of a file position indicator
associated with such a device is undefined.
If the file is opened for append mode, the file position indicator is set
to the end of the file prior to each write.
If write() requests that more bytes be written than there is room for,
write() fails and -1 is returned.
[REV BEG]
NOTE If linking with the POSIX/iX library, refer to the description of
write() located in the MPE/iX Developer's Kit Reference Manual.
[REV END]
See Also
read(), open()
MPE/iX 5.0 Documentation