I was using C++ function:
_int64 FileSize(const wchar_t* name)
{
WIN32_FILE_ATTRIBUTE_DATA fad;
if (!GetFileAttributesEx(name, GetFileExInfoStandard, &fad))
return -1; // error condition, could call GetLastError to find out more
LARGE_INTEGER size;
size.HighPart = fad.nFileSizeHigh;
size.LowPart = fad.nFileSizeLow;
return size.QuadPart;
}
to get the file size of a big 5 GB text file which was working well in Visual Studio x64 5 years ago. After recent Visual Studio updates it stopped working. How to fix it?
I was trying to use _stat64 function but got the problem with conversion of wchar_t* to char*:
_int64 FileSize(const wchar_t* name) {
struct _stat64i32 buf;
int result;
char timebuf[26];
//char* filename = "crt_stat.c";
errno_t err;
result = _wstat64(name, &buf);
return buf.st_size;
}
but I got the error:
The argument of type “_stat64i32 *” is incompatible with the parameter of type “_stat64 *”.