Sunday, February 20, 2011

Determine File Size in C/C++, Fast

The following is a fast way of determining a file's size in C/C++.  This code assumes a standard file pointer (FILE*) named 'file'.

    // Determine the file size
    fseek(file, 0L, SEEK_END);
    fileSize = ftell(file);
    rewind(file);

1 comment: