开发者

QSocketNotifier - How to use it to watch a file? - linux

开发者 https://www.devze.com 2023-01-23 17:09 出处:网络
I want my c++ appli开发者_Python百科cation to watch for changes in a file called \"aaa\". I want to do it by QSocketNotifier. I didn\'t understand from the documentation how to do it. Can you please s

I want my c++ appli开发者_Python百科cation to watch for changes in a file called "aaa". I want to do it by QSocketNotifier. I didn't understand from the documentation how to do it. Can you please send me a sample?

10!


Use QFileSystemWatcher. It performs all the inotify hackery for you.


The QSocketNotifier class works with sockets, not files. Since it apparently uses select(2) under the hood, you might get away with passing it a file descriptor returned by inotify_init() and trick it into monitoring file changes that way. That's highly doubtful, though.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号