If I use
fseek(file_ptr, 0, SEEK_END);
size = ftell(file_ptr);
I get 480000 which is right as I have 60000 x double float at 8 bytes per double in the file.
But when I use
fseek(file_ptr, sizeof(double), SEEK_END);
size = ftell(file_ptr);
I get 480008 an extra 8 bytes. Anyone know what they are?
That is because the size of a
doubleon your system is 8 bytes, andfseek()set the file position indicator 8 bytes fromSEEK_END.Re:
This is what the open group's manual page has to say about it:
Note that this behaviour is only specified for POSIX-compliant systems.