Wednesday, 8 June 2011

How to get bytes count of file over 2gb (64bit) in C / C++ and output 64bit int as char text string

#include <io.h>
#include <fcntl.h>

char sizeOfFile[20] = { '\0' };
int fh = _open( "c:\\myfile.mp4", _O_RDONLY | _O_BINARY );
 __int64 len64 = _lseeki64(fh,0L,SEEK_END);
 _i64toa( len64, sizeOfFile, 10 );
 _close(fh);

No comments:

Post a Comment