我想将strFileNotifyInfo[1].FileName (Wchar_t) 转换为字符串,以便我可以看到文件路径。但我不能让它工作。
这是我的代码:
while(TRUE)
{
if( ReadDirectoryChangesW( hDir, (LPVOID)&strFileNotifyInfo, sizeof(strFileNotifyInfo), FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE || FILE_NOTIFY_CHANGE_CREATION, &dwBytesReturned, NULL, NULL) == 0)
{
cout << "Reading Directory Change" << endl;
}
else
{
cout << ("File Modified: ") << strFileNotifyInfo[1].FileName << endl;
cout << ("Loop: ") << nCounter++ << endl;
}
}