C fsetpos()

The fsetpos() function moves file position indicator to the location specified by the object pointed to by position. This value must have been previously obtained through a call to the fgetpos(). After the fsetpos() is executed, the end-of-file indicator is reset. Also, any previous call to ungetc() is nullified.

fsetpos() Syntax

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

The fsetpos() returns zero on success, otherwise returns non-zero on failure.

fsetpos() Example

Following c code resets the current file position indicator to the value stored in the file_loc:

fsetpos(fp, &file_loc);

C Online Test

« Previous Function Next Function »

Like/Share Us on Facebook 😋