When you have a pointer to a FILE structure, what's the standard way of determining the size (in bytes) of the open file?
Name:
Anonymous2010-05-29 16:03
Use fseek to position the file pointer at the end of the file, then get the position using ftell and finally use fseek or rewind to position the file pointer back at the start.
ftell returns the offset as a long int, so it may fail on files whose sizes cannot be represented as a long int.
>>1 fstat or fseek+ftell. >>3
Don't be silly. sizeof is for seeing how much storage a concrete variable needs. It's a compile time operator (the value is known at compile time), and thus it wouldn't work for such purposes.