How to be notified of file/directory change in C/C++, ideally using POSIX

前端 未结 7 826
无人及你
无人及你 2020-12-08 04:40

The subject says it all - normally easy and cross platform way is to poll, intelligently. But every OS has some means to notify without polling. Is it possible in a reasonab

7条回答
  •  情歌与酒
    2020-12-08 05:28

    I believe OS X now has appropriate hooks/callbacks because they were needed for Spotlight indexing.

    On linux you'll have the additional trouble that there are multiple file systems commonly used. If you need the functionality for only a limited amount of files/directories, I'd try about actively looking for modifications at regular intervals.

提交回复
热议问题