2

我希望我的 c++ 应用程序监视名为“aaa”的文件中的更改。我想通过 QSocketNotifier 来做。我从文档中不明白如何做到这一点。你能给我寄一份样品吗?

10!

4

2 回答 2

4

使用QFileSystemWatcher。它为您执行所有 inotify 黑客程序。

于 2010-11-03T16:21:33.763 回答
2

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.

于 2010-11-02T13:03:37.260 回答