PDA

View Full Version : How to get the size of very large files?


jeanl
20th June 2005, 00:00
Guys,
How can I get the size of very large files (> 4GB) in C++?
I've been using _stat() but that returns the wrong size in such cases (it seems to return the size modulo 4GB - 2^32 bytes)...
Any pointer would be appreciated...
jeanl

mpucoder
20th June 2005, 00:10
use _filelengthi64 if the file was opened with _open, or you can use _stati64

My documentation for _stati64 is wrong, so here is the correct function prototype:
int _stati64(const char *, struct _stati64 *);

jeanl
20th June 2005, 06:41
Thanks mpucoder, that worked... And thanks for the function prototype, mine's wrong too! LAAAAME!
jeanl