1FGETPOS(3P) POSIX Programmer's Manual FGETPOS(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 fgetpos — get current file position information
13
15 #include <stdio.h>
16
17 int fgetpos(FILE *restrict stream, fpos_t *restrict pos);
18
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 fgetpos() function shall store the current values of the parse
26 state (if any) and file position indicator for the stream pointed to by
27 stream in the object pointed to by pos. The value stored contains
28 unspecified information usable by fsetpos() for repositioning the
29 stream to its position at the time of the call to fgetpos().
30
31 The fgetpos() function shall not change the setting of errno if suc‐
32 cessful.
33
35 Upon successful completion, fgetpos() shall return 0; otherwise, it
36 shall return a non-zero value and set errno to indicate the error.
37
39 The fgetpos() function shall fail if:
40
41 EBADF The file descriptor underlying stream is not valid.
42
43 EOVERFLOW
44 The current value of the file position cannot be represented
45 correctly in an object of type fpos_t.
46
47 ESPIPE The file descriptor underlying stream is associated with a pipe,
48 FIFO, or socket.
49
50 The following sections are informative.
51
53 None.
54
56 None.
57
59 None.
60
62 None.
63
65 Section 2.5, Standard I/O Streams, fopen(), ftell(), rewind(), ungetc()
66
67 The Base Definitions volume of POSIX.1‐2017, <stdio.h>
68
70 Portions of this text are reprinted and reproduced in electronic form
71 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
72 table Operating System Interface (POSIX), The Open Group Base Specifi‐
73 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
74 Electrical and Electronics Engineers, Inc and The Open Group. In the
75 event of any discrepancy between this version and the original IEEE and
76 The Open Group Standard, the original IEEE and The Open Group Standard
77 is the referee document. The original Standard can be obtained online
78 at http://www.opengroup.org/unix/online.html .
79
80 Any typographical or formatting errors that appear in this page are
81 most likely to have been introduced during the conversion of the source
82 files to man page format. To report such errors, see https://www.ker‐
83 nel.org/doc/man-pages/reporting_bugs.html .
84
85
86
87IEEE/The Open Group 2017 FGETPOS(3P)