![]() |
![]() |
![]() |
Write into a file without changing the file pointer
#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 );
libc
The pwrite() function performs the same action as write(), except that it writes into a given position without changing the file pointer. The first three arguments to pwrite() are the same as write() with the addition of a fourth argument, offset for the desired position inside the file.
The pwrite64() function is a 64-bit version of pwrite().
The number of bytes actually written, or -1 if an error occurred (errno is set).
pwrite() is standard Unix; pwrite64() is for large-file support
Safety: | |
---|---|
Cancellation point | Yes |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
close(), creat(), dup(), dup2(), errno, fcntl(), lseek(), open(), pipe(), pread(), read(), readv(), select(), write(), writev()
![]() |
![]() |
![]() |