#include <stdio.h> offset = ftell( f );
"ftell" returns the current position for input or output on the file indicated by "f". "offset" is not precisely a byte offset from the beginning of the file. Instead it is a logical offset that can be used by "fseek".
We recommend that you use the ANSI standard functions "fsetpos" and "fgetpos" instead of "fseek" and "ftell". The reason is that "fseek" and "ftell" only use a long integer (36 bits) to represent a position in a file; this is not adequate to deal with all the positions in a large file on some systems. On the other hand, "fgetpos" and "fsetpos" use a larger information structure to represent file positions and can deal with any size file.
expl c lib fseek
expl c lib fgetpos
expl c lib fsetpos
Copyright © 1996, Thinkage Ltd.