Writes data to a file.
#include <unistd.h> ssize_t pwrite ( int fildes, const void *buf, size_t nbytes, off_t off);
(IN) Specifies a file descriptor.
(IN) Points to the address at which to start transmitting data.
(IN) Specifies the number of bytes to write.
(IN) Specifies the starting offset in the file for the write.
If successful, returns the number of bytes of data actually written. Otherwise, returns -1 and sets errno to one of the following:
The pwrite function attempts to write nbytes from the buffer pointed to by buf to the file associated with the open file descriptor, fildes.The data is written to the file at the position specified by the off parameter.
The fildes value is returned by open or creat. The access mode must have included either O_WRONLY or O_RDWR when the file was opened.