Advertisement

Newbie: Filesize

Started by September 12, 2000 10:20 AM
3 comments, last by LaBasX2 24 years, 5 months ago
Hi! Can anyone please tell me how to get the size of a file? Thanks
you can try :

long filelength(int file_handle )
where file_handle=fileno(ptr_file)

The header to declare with is stdio.h. But warning! this function is not ANSI C.
Hope that help!

ECLIPSE DE SOLEIL PAR NOTRE LUNE...lunasol
Advertisement
I''ll try it.

Thanks for your help!
Here''s another way of doing it...

FILE* f = fopen("whatever.ext", "rb");
fseek(f, 0, SEEK_END);
int size = ftell(f);
fclose(f);

"Paranoia is the belief in a hidden order behind the visible." - Anonymous
Thanks, that''s exactly what I needed!

This topic is closed to new replies.

Advertisement