fsetpos(), fsetpos64()

reposition file position indicator for stream 

Function


SYNOPSIS

#include <stdio.h>

int fsetpos(FILE *stream, const fpos_t *pos);

int fsetpos64(FILE *stream, const fpos64_t *pos);


DESCRIPTION

The fsetpos() function repositions a file position indicator for a stream. The positional information stored in the structure pointed to by pos must be a value obtained by an earlier call to fgetpos() on the same stream.

A successful call to fsetpos() clears the end-of-file indicator for the stream and undoes any effects of ungetc() on the same stream. After a fsetpos() call, the next operation on an update stream may be either input or output.

The fsetpos64() function is identical to the fsetpos() function except that it is capable of dealing with disk files that are larger than 2 gigabytes. The fsetpos64() function is a part of the large file extensions.


PARAMETERS

stream 

Points to the stream whose file position indicator is to be changed.

pos 

Points to a structure that holds positional information.


RETURN VALUES

If successful, the fsetpos() and fsetpos64() function return zero. On failure, they return non-zero and errno is set to one of the following values:

EAGAIN 

The O_NONBLOCK flag is set for the file descriptor underlying stream, and the process would be delayed in the write operation.

EBADF 

The file descriptor underlying stream is not valid.

EINTR 

A signal interrupted the call.

EINVAL 

The whence argument is invalid.

ENOSPC 

There was no free space remaining on the device containing the file.

EPIPE 

The file underlying stream is a pipe or a FIFO.


CONFORMANCE

ANSI/ISO 9899-1990.

fsetpos64(): Large File Specification, revision 1.5.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

If the stream is writable, and there is buffered data which has not yet been written to the file, fsetpos() and fsetpos64() cause the unwritten data to be written before the file position indicator is moved.

The file positions reported by fgetpos(), ftell(), or ftello() may be incorrect for files that are open in text mode in the case that the file is being read, or the case where the file is being written to and there is buffered data which has not yet been written to the underlying file. In the case that the file is being written to, fflush() can be used prior to calling fgetpos(), ftell(), ftello() to ensure the accuracy of these functions. Text mode files with no buffering do not have this problem, however performance can be significantly degraded with buffering turned off.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
fgetpos(), fseek(), lseek()

Miscellaneous:
lf64


PTC MKS Toolkit 10.2 Documentation Build 28.