set the current file position
#include <stdio.h> int fsetpos( FILE *fp, fpos_t *pos );
The fsetpos() function positions the file fp according to the value of the object pointed to by pos, which must be a value returned by an earlier call to the fgetpos() function on the same file.
errno, fgetpos(), fopen(), fseek(), ftell()
#include <stdio.h>
void main()
{
FILE *fp;
fpos_t position;
char buffer[80];
fp = fopen( "file", "r" );
if( fp != NULL ) {
fgetpos( fp, &position ); /* get position */
fgets( buffer, 80, fp ); /* read record */
fsetpos( fp, & position ); /* set position */
fgets( buffer, 80, fp ); /* read same record */
fclose( fp );
}
}
ANSI
All (except DOS/PM)