Reads data from a file.
#include <unistd.h> ssize_t pread64 ( int fildes, void *buf, size_t nbytes, off64_t off);
(IN) Specifies a file descriptor.
(OUT) Points to a buffer to receive the data.
(IN) Specifies the number of bytes to read.
(IN) Specifies the starting offset in the file for the read.
If successful, returns the number of bytes of data transmitted from the file to the buffer. Normally, this is the number given by the nbytes parameter. When the end-of-file is encountered before the read completes, the return value is less than the number of bytes requested.
If nbytes is 0, returns 0 and may set errno to one of the following. If unsuccessful, returns a -1 and sets errno to one of the following:
The pread64 function returns the number of bytes of data transmitted from the file to the buffer.
The fildes parameter is a value returned by the open or creat function. When the file was opened, the access mode must have included either O_RDONLY or O_RDWR.
The data is read starting at the position specified by the off parameter. If any portion of the file prior to the end-of-file has not been written, the pread64 function returns bytes with value 0.
The pread64 function is equivalent to pread except that it handles files larger than 2 GB.