I am working on a system file monitoring tool. I need to be able to tell what files have/are being read (keyword is READ not modified). Things I have tried:
does not work... So i tried fileinfo last access...Code:bool isFileOpen(string inputFile){
fstream myfile;
try{
myfile.open (inputFile);//always true if file exists
}
}
catch (int i){
return true;//does not catch if file exists
}
return false;
}
although the above code does work, it does not have instant notifcation of last access timestamp.Code:DateTime dtmFileLastModified = File.GetLastWriteTime("C:\blah\filename.csv");
I have also explored all the filters for FileSystemWatcher as well
any ideas?Code:watcher->NotifyFilter = static_cast<NotifyFilters>(NotifyFilters::LastAccess |
NotifyFilters::LastWrite | NotifyFilters::FileName | NotifyFilters::DirectoryName |
NotifyFilters::CreationTime);
Chris
SDK - Visual Studio
OS - Windows 7 64 bit