c++ fread changing fgetpos strangely
- by Steve
If I run:
FILE* pFile = fopen("c:\\08.bin", "r");
fpos_t pos;
char buf[5000];
int ret = fread(&buf, 1, 9, pFile);
fgetpos(pFile, &pos);
I get ret = 9 and pos = 9.
However if I run
FILE* pFile = fopen("c:\\08.bin", "r");
fpos_t pos;
char buf[5000];
int ret = fread(&buf, 1, 10, pFile);
fgetpos(pFile, &pos);
ret = 10 as expected, but pos = 11!
How can this be?