1PREAD(2)                   Linux Programmer's Manual                  PREAD(2)
2
3
4

NAME

6       pread, pwrite - read from or write to a file descriptor at a given off‐
7       set
8

SYNOPSIS

10       #define _XOPEN_SOURCE 500
11
12       #include <unistd.h>
13
14       ssize_t pread(int fd, void *buf, size_t count, off_t offset);
15
16       ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
17

DESCRIPTION

19       pread() reads up to count bytes from file descriptor fd at offset  off‐
20       set  (from the start of the file) into the buffer starting at buf.  The
21       file offset is not changed.
22
23       pwrite() writes up to count bytes from the buffer starting  at  buf  to
24       the  file  descriptor  fd  at  offset  offset.   The file offset is not
25       changed.
26
27       The file referenced by fd must be capable of seeking.
28

RETURN VALUE

30       On success, the number of bytes read or written is returned (zero indi‐
31       cates  that  nothing  was  written,  in the case of pwrite(), or end of
32       file, in the case of pread(), or -1 on error, in which  case  errno  is
33       set to indicate the error.
34

ERRORS

36       pread()  can  fail  and set errno to any error specified for read(2) or
37       lseek(2).  pwrite() can fail and set errno to any error  specified  for
38       write(2) or lseek(2).
39

VERSIONS

41       The  pread()  and  pwrite() system calls were added to Linux in version
42       2.1.60; the entries in the i386 system call table were added in 2.1.69.
43       C  library support (including emulation using lseek(2) on older kernels
44       without the system calls) was added in glibc 2.1.
45

CONFORMING TO

47       POSIX.1-2001.
48

SEE ALSO

50       lseek(2), read(2), write(2), feature_test_macros(7)
51

COLOPHON

53       This page is part of release 3.22 of the Linux  man-pages  project.   A
54       description  of  the project, and information about reporting bugs, can
55       be found at http://www.kernel.org/doc/man-pages/.
56
57
58
59Linux                             2008-12-03                          PREAD(2)
Impressum