Name: Anonymous 2009-04-17 4:56
Whats the most crossplatform way to get file length in C?
FILE *f;
long len;
f = fopen("file", "r");
fseek(f, 0, SEEK_END);
len = ftell(f);
fclose(f);fstat() is POSIX and is more or less uniform across GNU/Linux, *BSD and Solaris (on Solaris struct elements are in wrong order but have standard names), however I'm not sure how it will behave on real operating systems like Windows 9x, Plan 9 and I-TRON.