Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pwrite.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pwrite.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pwrite.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pwrite.html on line 8

pwrite(), pwrite64()

Write into a file without changing the file pointer

Synopsis:

#include <unistd.h>

ssize_t pwrite( int filedes,
                const void* buff,
                size_t nbytes,
                off_t offset );

ssize_t pwrite64( int filedes,
                  const void* buff,
                  size_t nbytes,
                  off64_t offset );

Arguments:

filedes
The file descriptor for the file you want to write in.
buff
A pointer to a buffer that contains the data you want to write.
nbytes
The number of bytes to write.
offset
The desired position inside the file.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The pwrite() function performs the same action as write(), except that it writes into a given position without changing the file pointer.

The pwrite64() function is a 64-bit version of pwrite().

Returns:

The number of bytes actually written, or -1 if an error occurred (errno is set).

Errors:

EAGAIN
The O_NONBLOCK flag is set for the file descriptor, and the process would be delayed in the write operation.
EBADF
The file descriptor, fildes, isn't a valid file descriptor open for writing.
EFBIG
File is too big.
EINTR
The write operation was interrupted by a signal, and either no data was transferred, or the resource manager responsible for that file doesn't report partial transfers.
EIO
A physical I/O error occurred (for example, a bad block on a disk). The precise meaning is device-dependent.
ENOSPC
There's no free space remaining on the device containing the file.
ENOSYS
The pwrite() function isn't implemented for the filesystem specified by filedes.
EPIPE
An attempt was made to write to a pipe (or FIFO) that isn't open for reading by any process. A SIGPIPE signal is also sent to the process.

Classification:

pwrite() is POSIX 1003.1 XSI; pwrite64() is Large-file support

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

close(), creat(), dup(), dup2(), errno, fcntl(), lseek(), open(), pipe(), pread(), read(), readv(), select(), write(), writev()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pwrite.html on line 208

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pwrite.html on line 208