int fsetpos ( FILE * stream , const fpos_t * position );
Reposition file pointer to a saved location.
Sets the file pointer associated with stream to a new position. The position parameter is a value previously obtained by a call to fgetpos.
After a call to this function, the End-Of-File indicator of the stream is cleared and any effect of a previous call to ungetc is undone.
The next operation with the stream after a call to fsetpos can be either for input or output.
If successful the function returns 0.
Otherwise it returns nonzero and sets the global variable errno to a non-zero value.
Defined in ANSI-C.
/* fsetpos example */
FILE * pFile;
pFile = fopen ("myfile.txt","w");
fgetpos (pFile, &position);
fputs ("That is a sample",pFile);
fsetpos (pFile, &position);
After this code is executed, a file called myfile.txt will
be created and will contain the sentence
This is a sample
fopen, fgetpos, fseek ftell, frewind