Search code examples
c++file-watcher

How to get filename on file chaged event in C++


I have followed this guide from MS and it works fine. Now I would like to ask you how to retrieve the filename of the file that was changed in the directory?


Solution

  • Once you've been notified of a change, you use ReadDirectoryChangesW to get the actual list of changes. The result will be an array of FILE_NOTIFY_INFORMATION structures, each one holding a filename and the offset of the next structure.