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

NAME

12       fsetpos — set current file position
13

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

EXAMPLES

98       None.
99

APPLICATION USAGE

101       None.
102

RATIONALE

104       None.
105

FUTURE DIRECTIONS

107       None.
108

SEE ALSO

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