Code: Select all
#include <stdio.h>
int main()
{
FILE * fp;
_off64_t pos;
fp = fopen("test.dat", "w+b");
fwrite("abcdefghijklmnopqrstuvwxyz", 1, 26, fp);
pos = ftello64(fp);
printf("ftello64 says our position is %d, it should be 26\n",
(int)pos);
fseeko64(fp, 0, SEEK_END);
pos = ftello64(fp);
printf("now ftello64 says our position is %d, it should still be 26\n", (int)pos);
return 0;
}
ftello64 says our position is -1, it should be 26
now ftello64 says our position is -1, it should still be 26
I assume -1 is an error, but I have no documentation as to what this actually means.