Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

get file length

Name: Anonymous 2009-04-17 4:56

Whats the most crossplatform way to get file length in C?

Name: Anonymous 2009-04-17 9:44

>>5
Not portable. Files opened in text mode need not return byte offsets from ftell() (the values might be "seek descriptors", suitable for passing to fseek() but useless otherwise).

>>8
Not portable. Files opened in binary mode need not support SEEK_END.

size_t n = 0; while (fgetc(f) != EOF) ++n;

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List