Code Snippets C

//Header file: #include
//Declaration: int fsetpos(FILE *stream, const fpos_t *position);
//Return: returns zero on success or nonzero on failure.
#include
#include
int main(int argc, char *argv[])
{
FILE *filep;
fpos_t file_loc;
if((filep=fopen("test","r"))==NULL) {
printf("Cannot open file.\n");
exit(1);
}
fgetpos(filep, &file_loc);
fsetpos(filep, &file_loc);
fclose(filep);
}