I have a file of approximately 4.19GB. I want to get the totall size of file using code in VC++, Here is my code

FILE *fptrSampleVideo = fopen(filename,"rb+");



uncompressedVideoSize = ftell(fptrSampleVideo);


If the file is of small size, ftell() return position correctly and the size is also correct.

If the file is of large size (4.19GB), ftell() return position 4, which is wrong.

It must return 4,190,000,000 etc. some thing like that.

can any one guide me what is the case?

Many Thanks,


ftell() returns a long int, and the max value is declared in limits.h. If yours is like mine then the 4 gigs is too big.