#include <stdio.h>
int main(void)
{
FILE *fp = fopen("d:\\data.txt", "w");
if (fp == NULL)
{
perror("Error open file");
return 1;
}
fpos_t pos;
fgetpos(fp, &pos);
printf("pos = %I64d\n", pos);
fputs("programming is fun", fp);
fsetpos(fp, &pos);
fputs("c programming is fun", fp);
fclose(fp);
return 0;
}
// file content: c programming is fun
/*
run:
pos = 0
*/