Atomically positions the file pointer and writes to the specified file.
#include <nks/fsio.h> int NXWrite ( NXHandle_t handle, NXOffset_t offset, size_t length, const void *address, unsigned long flags, size_t *bytesWritten);
(IN) Specifies a file handle (or descriptor), which refers to a system-maintained state description for a file and was obtained from calling a create or open function. If a FIFO or other sequential I/O device is specified, all values that might be in offset are ignored.
(IN) Specifies the starting offset for writing to the file.
(IN) Specifies the number of bytes to be written. If zero, NXWrite returns zero and has no other results. If the value is greater than NX_MAX_FILESIZE, the result is undefined.
(IN) Points to the memory address, which is meaningful in your virtual machine, where the data to be written should be placed.
(IN) Pass 0.
(OUT) Points to the number of bytes actually written. On failure, returns -1.
If successful, returns 0, and in bytesWritten, a non-negative integer indicating the number of bytes actually written. Otherwise, returns one of the following error codes.
NXWrite attempts to write the specified number of bytes from the specified buffer to the file associated with the file handle.
If more bytes than there are room for are requested to be written (for example, if the write would exceed the system file size limit or the free space on the device), only the bytes that there are room for will be written. For example suppose there is space for 20 more bytes before reaching a limit. A write of 512 bytes returns 20. The next write of a nonzero number of bytes will fail and the file size is set to the length at which the write operation ended.
An NXWrite operation also updates the modification time and the time of the last status change.