1FSETPOS(3P) POSIX Programmer's Manual FSETPOS(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 fsetpos - set current file position
13
15 #include <stdio.h>
16
17 int fsetpos(FILE *stream, const fpos_t *pos);
18
19
21 The fsetpos() function shall set the file position and state indicators
22 for the stream pointed to by stream according to the value of the
23 object pointed to by pos, which the application shall ensure is a value
24 obtained from an earlier call to fgetpos() on the same stream. If a
25 read or write error occurs, the error indicator for the stream shall be
26 set and fsetpos() fails.
27
28 A successful call to the fsetpos() function shall clear the end-of-file
29 indicator for the stream and undo any effects of ungetc() on the same
30 stream. After an fsetpos() call, the next operation on an update stream
31 may be either input or output.
32
33 The behavior of fsetpos() on devices which are incapable of seeking is
34 implementation-defined. The value of the file offset associated with
35 such a device is undefined.
36
38 The fsetpos() function shall return 0 if it succeeds; otherwise, it
39 shall return a non-zero value and set errno to indicate the error.
40
42 The fsetpos() function shall fail if, either the stream is unbuffered
43 or the stream's buffer needed to be flushed, and the call to fsetpos()
44 causes an underlying lseek() or write() to be invoked, and:
45
46 EAGAIN The O_NONBLOCK flag is set for the file descriptor and the
47 process would be delayed in the write operation.
48
49 EBADF The file descriptor underlying the stream file is not open for
50 writing or the stream's buffer needed to be flushed and the file
51 is not open.
52
53 EFBIG An attempt was made to write a file that exceeds the maximum
54 file size.
55
56 EFBIG An attempt was made to write a file that exceeds the process'
57 file size limit.
58
59 EFBIG The file is a regular file and an attempt was made to write at
60 or beyond the offset maximum associated with the corresponding
61 stream.
62
63 EINTR The write operation was terminated due to the receipt of a sig‐
64 nal, and no data was transferred.
65
66 EIO A physical I/O error has occurred, or the process is a member of
67 a background process group attempting to perform a write() to
68 its controlling terminal, TOSTOP is set, the process is neither
69 ignoring nor blocking SIGTTOU, and the process group of the
70 process is orphaned. This error may also be returned under
71 implementation-defined conditions.
72
73 ENOSPC There was no free space remaining on the device containing the
74 file.
75
76 ENXIO A request was made of a nonexistent device, or the request was
77 outside the capabilities of the device.
78
79 EPIPE The file descriptor underlying stream is associated with a pipe
80 or FIFO.
81
82 EPIPE An attempt was made to write to a pipe or FIFO that is not open
83 for reading by any process; a SIGPIPE signal shall also be sent
84 to the thread.
85
86
87 The following sections are informative.
88
90 None.
91
93 None.
94
96 None.
97
99 None.
100
102 fopen(), ftell(), lseek(), rewind(), ungetc(), write(), the Base Defi‐
103 nitions volume of IEEE Std 1003.1-2001, <stdio.h>
104
106 Portions of this text are reprinted and reproduced in electronic form
107 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
108 -- Portable Operating System Interface (POSIX), The Open Group Base
109 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
110 Electrical and Electronics Engineers, Inc and The Open Group. In the
111 event of any discrepancy between this version and the original IEEE and
112 The Open Group Standard, the original IEEE and The Open Group Standard
113 is the referee document. The original Standard can be obtained online
114 at http://www.opengroup.org/unix/online.html .
115
116
117
118IEEE/The Open Group 2003 FSETPOS(3P)