0
我收到此錯誤,無法更正它。任何幫助表示讚賞。謝謝。 錯誤C2440:「=」:不能從「DWORD *」轉換爲「無符號整型」 智能感知:類型「DWORD *」不能被分配給類型「無符號整型」的實體DWORD和unsigned int
using namespace std;
typedef vector<WIN32_FIND_DATA> tFoundFilesVector;
std::wstring LastWriteTime;
int getFileList(wstring filespec, tFoundFilesVector &foundFiles)
{
WIN32_FIND_DATA findData;
HANDLE h;
int validResult=true;
int numFoundFiles = 0;
h = FindFirstFile(filespec.c_str(), &findData);
if (h == INVALID_HANDLE_VALUE)
return 0;
while (validResult)
{
numFoundFiles++;
foundFiles.push_back(findData);
validResult = FindNextFile(h, &findData);
}
return numFoundFiles;
}
void showFileAge(tFoundFilesVector &fileList)
{
unsigned int fileTime,curTime, age;
tFoundFilesVector::iterator iter;
FILETIME ftNow;
__int64 nFileSize;
LARGE_INTEGER li;
li.LowPart = ftNow.dwLowDateTime;
li.HighPart = ftNow.dwHighDateTime;
CoFileTimeNow(&ftNow);
curTime = ((_int64) &ftNow.dwHighDateTime << 32) + &ftNow.dwLowDateTime;
for (iter=fileList.begin(); iter<fileList.end(); iter++)
{
fileTime = ((_int64)iter->ftLastWriteTime.dwHighDateTime << 32) + iter- >ftLastWriteTime.dwLowDateTime;
age = curTime - fileTime;
cout << "FILE: '" << iter->cFileName << "', AGE: " << (INT64)age/10000000UL << " seconds" << endl;
}
}
int main()
{
string fileSpec = "*.*";
tFoundFilesVector foundFiles;
tFoundFilesVector::iterator iter;
int foundCount = 0;
getFileList(L"*.c??", foundFiles);
getFileList(L"*.h", foundFiles);
foundCount = foundFiles.size();
if (foundCount)
{
cout << "Found "<<foundCount<<" matching files.\n";
showFileAge(foundFiles);
}
return 0;
}
的值它在這條線.....
謝謝!!!!第一個問題解決!我怎樣才能使這些64位整數,從來沒有處理這個。謝謝。 –
你可以使用'unsigned long long'。但是由於你在Windows上,你可以使用'unsigned __int64'。 – Mysticial
賓果!謝謝! –