#include <stdio.h>
int main(void)
{
char ch;
FILE *fp = fopen("d:\\data.txt", "r");
if (fp == NULL)
perror ("Error open file");
else
{
fpos_t pos = 0;
ch = fgetc(fp);
printf("ch = %c\n", ch);
fgetpos(fp, &pos);
printf("pos = %I64d\n", pos);
ch = fgetc(fp);
printf("ch = %c\n", ch);
fgetpos(fp, &pos);
printf("pos = %I64d\n", pos);
fclose(fp);
}
return 0;
}
/*
run:
ch = T
pos = 1
ch = h
pos = 2
*/