Name

fsetpos

Synopsis

Sets a file position indicator to a previously recorded position

#include <stdio.h>
intfsetpos( FILE *fp, const fpos_t *ppos );

The fsetpos() function sets the file position indicator for the file specified by the FILE pointer argument. The ppos argument, a pointer to the value of the new position, typically points to a value obtained by calling the fgetpos() function.

The function returns 0 if successful. If an error occurs, fsetpos() returns a nonzero value and sets the errno variable to an appropriate positive value.

The type fpos_t is defined in stdio.h, and may or may not be an integer type.

Example

See the example for fgetpos() in this chapter.

Get C in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.