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 set
33       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

CONFORMING TO

41       POSIX.1-2001.
42

HISTORY

44       The  pread()  and  pwrite() system calls were added to Linux in version
45       2.1.60; the entries in the i386 system call table were added in 2.1.69.
46       The libc support (including emulation on older kernels without the sys‐
47       tem calls) was added in glibc 2.1.
48

SEE ALSO

50       lseek(2), read(2), write(2), feature_test_macros(7)
51
52
53
54Linux 2.2.0-pre9                  1999-01-21                          PREAD(2)
Impressum