filelength()

another simple question: if i open a file how can i acquire it’s length?
for example :

long int file_length;
FILE *fd;
fd = fopen( “file”, “r” );
in Turbo C it will be : file_length=filelength(fd);
but in qnx , i couldn’t find such function . i think there must be a such func ,but i don’t know where it is .

ofcouse, i can get the length by scanning the whole file , but i just want to find such a func.

thanks, thanks , thanks …

stat() or fstat() are the functions you are looking for. Standard POSIX.

Thanks , cdm !

fseek( SEEK_END);
ftell()
fseek(0, SEEK_SET);