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

NAME

6       fsetpos - set current file position
7

SYNOPSIS

9       #include <stdio.h>
10
11       int fsetpos(FILE *stream, const fpos_t *pos);
12
13

DESCRIPTION

15       The fsetpos() function shall set the file position and state indicators
16       for the stream pointed to by stream  according  to  the  value  of  the
17       object pointed to by pos, which the application shall ensure is a value
18       obtained from an earlier call to fgetpos() on the  same  stream.  If  a
19       read or write error occurs, the error indicator for the stream shall be
20       set and fsetpos() fails.
21
22       A successful call to the fsetpos() function shall clear the end-of-file
23       indicator  for  the stream and undo any effects of ungetc() on the same
24       stream. After an fsetpos() call, the next operation on an update stream
25       may be either input or output.
26
27       The  behavior of fsetpos() on devices which are incapable of seeking is
28       implementation-defined. The value of the file  offset  associated  with
29       such a device is undefined.
30

RETURN VALUE

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

ERRORS

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

EXAMPLES

84       None.
85

APPLICATION USAGE

87       None.
88

RATIONALE

90       None.
91

FUTURE DIRECTIONS

93       None.
94

SEE ALSO

96       fopen() , ftell() , lseek() , rewind() , ungetc() , write() , the  Base
97       Definitions volume of IEEE Std 1003.1-2001, <stdio.h>
98
100       Portions  of  this text are reprinted and reproduced in electronic form
101       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
102       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
103       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
104       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
105       event of any discrepancy between this version and the original IEEE and
106       The  Open Group Standard, the original IEEE and The Open Group Standard
107       is the referee document. The original Standard can be  obtained  online
108       at http://www.opengroup.org/unix/online.html .
109
110
111
112IEEE/The Open Group                  2003                           FSETPOS(P)
Impressum