This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/clibexam/fgetpos.c

18 lines
402 B
C
Raw Permalink Normal View History

#include <stdio.h>
void main()
{
FILE *fp;
fpos_t position;
auto 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 );
}
}