Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

fseeko(3) Guardian Native C Library Calls Reference Manual
If the most recent operation (ignoring any ftell( ) operations) on a given stream was fflush( ), the
fseeko() function causes the file offset in the underlying open file descriptor to be adjusted to
reflect the location specified by the fseeko() function.
The fseeko() function allows the file-position indicator to be set beyond the end of existing data
in the file. If data is later written at this point, subsequent reads of data in the gap will return
bytes with the value 0 (zero) until data is actually written into the gap. The fseeko() function
does not, by itself, extend the size of a file.
Information About Guardian EDIT Files
If called from a native process, the fseeko() function can operate on Guardian EDIT files (type
101 files). The behavior of this function differs according to whether the file is opened with a
Guardian connection or with an OSS connection.
To operate on a Guardian EDIT file using a Guardian connection to that file, you must open a
stream by calling:
fopen_guardian(), freopen_guardian(), or a similar function from any process
fopen( ), freopen(), or a similar function from a process executing in the Guardian
environment
When the stream references a Guardian EDIT file using a Guardian connection, a call to the
fseeko() function implements a position operation as if an equivalent call were being made to the
edfseeko() function.
To operate on a Guardian EDIT file using an OSS connection, you must open a stream by calling:
fopen_oss( ), freopen_oss(), or a similar function from any process
fopen( ), freopen(), or a similar function from a process executing in the OSS environ-
ment
When the stream references a Guardian EDIT file using an OSS connection, calls to the fseeko()
function are implemented using the lseek() function. For information about the lseek() function,
see the lseek(2) reference page.
RETURN VALUES
Upon successful completion, the fseeko() function returns a value of 0 (zero). If the fseeko()
function fails, a value of -1 is returned, and errno is set to indicate the error.
ERRORS
The fseeko() function fails if either the stream is unbuffered, or the stream’s buffer needed to be
flushed and the call to fseeko() caused an underlying lseek() or write() function to be invoked.
In addition, if any of these conditions occurs, the fseeko() function sets errno to the correspond-
ing value.
[EAGAIN] The O_NONBLOCK flag is set for the file descriptor underlying the stream
parameter, and the process is in the write operation.
[EBADF] The file descriptor underlying the stream parameter is not a valid file descriptor
open for writing.
[EFBIG] The buffers of the stream need to be flushed, and the starting point is greater than
or equal to an offset of 2 gigabytes. The file offset maximum for this function,
for both OSS files and Guardian files, is 2 gigabytes.
2140 Hewlett-Packard Company 527192-018