Hi All,
Just a quick question. I have a data file that is over 2GB and I need a file size reading.
below is my current code
Meth1
Meth2
both methords below return - numbers when the files get over 2GB, any help is appreciated
Just a quick question. I have a data file that is over 2GB and I need a file size reading.
below is my current code
Meth1
Code:
unsigned long GetFileLength ( FILE * fileName)
{
unsigned long pos = ftell(fileName);
unsigned long len = 0;
fseek ( fileName, 0L, SEEK_END );
len = ftell ( fileName );
fseek ( fileName, pos, SEEK_SET );
return len;
}
Meth2
Code:
unsigned long GetFileLength2 ( char * fileName)
{
struct stat buf;
int i = stat ( fileName, &buf );
if (i !=0)
MessageBox(NULL,"ERROR for STAT","ERROR",0);
return buf.st_size;
}