1FSETPOS(3P)                POSIX Programmer's Manual               FSETPOS(3P)
2
3
4

PROLOG

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
11

NAME

13       fsetpos — set current file position
14

SYNOPSIS

16       #include <stdio.h>
17
18       int fsetpos(FILE *stream, const fpos_t *pos);
19

DESCRIPTION

21       The functionality described on this reference page is aligned with  the
22       ISO C  standard.  Any  conflict between the requirements described here
23       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2008
24       defers to the ISO C standard.
25
26       The fsetpos() function shall set the file position and state indicators
27       for the stream pointed to by stream  according  to  the  value  of  the
28       object pointed to by pos, which the application shall ensure is a value
29       obtained from an earlier call to fgetpos() on the  same  stream.  If  a
30       read or write error occurs, the error indicator for the stream shall be
31       set and fsetpos() fails.
32
33       A successful call to the fsetpos() function shall clear the end-of-file
34       indicator  for  the stream and undo any effects of ungetc() on the same
35       stream. After an fsetpos() call, the next operation on an update stream
36       may be either input or output.
37
38       The  behavior of fsetpos() on devices which are incapable of seeking is
39       implementation-defined.  The value of the file offset  associated  with
40       such a device is undefined.
41
42       The  fsetpos()  function  shall not change the setting of errno if suc‐
43       cessful.
44

RETURN VALUE

46       The fsetpos() function shall return 0 if  it  succeeds;  otherwise,  it
47       shall return a non-zero value and set errno to indicate the error.
48

ERRORS

50       The  fsetpos()  function shall fail if, either the stream is unbuffered
51       or the stream's buffer needed to be flushed, and the call to  fsetpos()
52       causes an underlying lseek() or write() to be invoked, and:
53
54       EAGAIN The  O_NONBLOCK  flag  is  set  for  the file descriptor and the
55              thread would be delayed in the write operation.
56
57       EBADF  The file descriptor underlying the stream file is not  open  for
58              writing or the stream's buffer needed to be flushed and the file
59              is not open.
60
61       EFBIG  An attempt was made to write a file  that  exceeds  the  maximum
62              file size.
63
64       EFBIG  An  attempt  was made to write a file that exceeds the file size
65              limit of the process.
66
67       EFBIG  The file is a regular file and an attempt was made to  write  at
68              or  beyond  the offset maximum associated with the corresponding
69              stream.
70
71       EINTR  The write operation was terminated due to the receipt of a  sig‐
72              nal, and no data was transferred.
73
74       EIO    A physical I/O error has occurred, or the process is a member of
75              a background process group attempting to perform  a  write()  to
76              its  controlling  terminal, TOSTOP is set, the calling thread is
77              not blocking SIGTTOU, the process is not ignoring  SIGTTOU,  and
78              the  process  group  of the process is orphaned.  This error may
79              also be returned under implementation-defined conditions.
80
81       ENOSPC There was no free space remaining on the device  containing  the
82              file.
83
84       EPIPE  An  attempt was made to write to a pipe or FIFO that is not open
85              for reading by any process; a SIGPIPE signal shall also be  sent
86              to the thread.
87
88       ESPIPE The file descriptor underlying stream is associated with a pipe,
89              FIFO, or socket.
90
91       The fsetpos() function may fail if:
92
93       ENXIO  A request was made of a nonexistent device, or the  request  was
94              outside the capabilities of the device.
95
96       The following sections are informative.
97

EXAMPLES

99       None.
100

APPLICATION USAGE

102       None.
103

RATIONALE

105       None.
106

FUTURE DIRECTIONS

108       None.
109

SEE ALSO

111       Section 2.5, Standard I/O Streams, fopen(), ftell(), lseek(), rewind(),
112       ungetc(), write()
113
114       The Base Definitions volume of POSIX.1‐2008, <stdio.h>
115
117       Portions of this text are reprinted and reproduced in  electronic  form
118       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
119       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
120       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
121       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
122       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
123       event of any discrepancy between this version and the original IEEE and
124       The  Open Group Standard, the original IEEE and The Open Group Standard
125       is the referee document. The original Standard can be  obtained  online
126       at http://www.unix.org/online.html .
127
128       Any  typographical  or  formatting  errors that appear in this page are
129       most likely to have been introduced during the conversion of the source
130       files  to  man page format. To report such errors, see https://www.ker
131       nel.org/doc/man-pages/reporting_bugs.html .
132
133
134
135IEEE/The Open Group                  2013                          FSETPOS(3P)
Impressum