pread() reads up to%uA0count%uA0bytes from file descriptor%uA0fd%uA0at offset%uA0offset%uA0(from the start of the file) into the buffer starting at%uA0buf. The file offset is not changed.
pwrite() writes up to%uA0count%uA0bytes from the buffer starting at%uA0buf%uA0to the file descriptor%uA0fdat offset%uA0offset. The file offset is not changed.
The file referenced by%uA0fd%uA0must be capable of seeking.
返回值
On success, the number of bytes read or written is returned (zero indicates that nothing was written, in the case of%uA0pwrite(), or end of file, in the case of%uA0pread), or -1 on error, in which case%uA0errno%uA0is set to indicate the error.
错误
pread() can fail and set%uA0errno%uA0to any error specified for%uA0read(2) or%uA0lseek(2).%uA0pwrite() can fail and set%uA0errno%uA0to any error specified for%uA0write(2) or%uA0lseek(2).
遵循于
POSIX.1-2001.
HISTORY
The%uA0pread() and%uA0pwrite() system calls were added to Linux in version 2.1.60 the entries in the i386 system call table were added in 2.1.69. The libc support (including emulation on older kernels without the system calls) was added in glibc 2.1.