HP-UX Reference (11i v2 04/09) - 3 Library Functions A-M (vol 6)

f
fseek(3S) fseek(3S)
flushed, or if any of the following conditions are encountered:
[EAGAIN]
The
O_NONBLOCK flag is set for the file descriptor and the process would be delayed in
the write operation.
[EBADF] The stream is NULL.
[EBADF] The underlying file is not open for writing.
[EFBIG] An attempt was made to write a file that exceeds the process’s file size limit or the max-
imum file size. See ulimit(2).
[EINVAL] The file offset cannot be represented correctly in an object of type
long or size off_t in
this environment.
[EINTR] A signal was caught during the write operation.
[EIO] The process is in a background process group and is attempting to write to its controlling
terminal,
TOSTOP is set, the process is neither ignoring nor blocking the
SIGTTOU sig-
nal, and the process group of the process is orphaned.
[ENOSPC]
There was no free space remaining on the device containing the file.
[EPIPE] An attempt was made to write to a pipe that is not open for reading by any process. A
SIGPIPE signal is also sent to the process.
[ESPIPE] A seek operation was attempted and the file descriptor underlying stream is associated
with a pipe.
fseek() and fseek_unlocked()
also fail if:
[EINVAL] The whence argument is invalid, or the file-position indicator would be set to a
negative value.
Additional
errno values may be set by the underlying write() and lseek() functions (see write(2)
and lseek(2)).
WARNINGS
On HP-UX systems, the offset returned by
ftell() or ftell_unlocked()
is measured in bytes and
it is permissible to seek to positions relative to that offset. However, when porting to non-HP-UX sys-
tems,
fseek() should be used directly without relying on any offset obtained from ftell() because
arithmetic cannot meaningfully be performed on such an offset if it is not measured in bytes on a particu-
lar operating system.
fseek(), fseek_unlocked()
, rewind(), and rewind_unlocked() have no effect on streams
that have been opened in append mode (see fopen(3S)).
fseek_unlocked(),
ftell_unlocked() and rewind_unlocked()
are obsolescent interfaces
supported for compatibility with existing DCE applications. New multithreaded applications should use
fseek(), ftell() and rewind().
SEE ALSO
lseek(2), write(2), ferror(3S), flockfile(3S), fopen(3S), fgetpos(3S), fgetpos64(3S), ungetc(3S),
thread_safety(5).
STANDARDS CONFORMANCE
fseek(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C
ftell(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C
rewind(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C
Section 3340 Hewlett-Packard Company 2 HP-UX 11i Version 2: September 2004