使用跨平台的API监视C中的文件系统?

时间:2022-05-31 02:37:48

I'm looking for a cross platform library to detect when files in a directory are added or modified.
I know there are OS specific way to do this (inotify for Linux, FindFirstChangeNotification for windows, etc...).

我正在寻找一个跨平台库来检测目录中的文件何时被添加或修改。我知道有一些特定于操作系统的方法可以做到这一点(intify for Linux, FindFirstChangeNotification,等等…)。

But is there a platform independent library that works specifically in C? (Like the QFileSystemWatcher in C++)

但是是否有一个独立于平台的库专门在C语言中工作?(比如c++中的QFileSystemWatcher)

2 个解决方案

#1


1  

inotify is Linux specific, if you want some UNIX portable features you are pobably looking for something like libfam. it is name of library. Full package name is fileschanged.

inotify是Linux特有的,如果你想要一些UNIX可移植特性,你可能需要一些libfam之类的东西。它是图书馆的名字。完整的包名是fileschanged。

fileschanged is a GNU/Linux command-line utility that reports when files have been altered.

fileschanged是一个GNU/Linux命令行实用程序,当文件被修改时报告。

#2


-3  

Sounds like a good use case for golang. Simply change $GOOS and/or $GOARCH and run go build.

这听起来像是一个不错的高尔夫用例。只需更改$GOOS和/或$GOARCH并运行go build。

Boom - trivial cross-platform development.

跨平台开发。

#1


1  

inotify is Linux specific, if you want some UNIX portable features you are pobably looking for something like libfam. it is name of library. Full package name is fileschanged.

inotify是Linux特有的,如果你想要一些UNIX可移植特性,你可能需要一些libfam之类的东西。它是图书馆的名字。完整的包名是fileschanged。

fileschanged is a GNU/Linux command-line utility that reports when files have been altered.

fileschanged是一个GNU/Linux命令行实用程序,当文件被修改时报告。

#2


-3  

Sounds like a good use case for golang. Simply change $GOOS and/or $GOARCH and run go build.

这听起来像是一个不错的高尔夫用例。只需更改$GOOS和/或$GOARCH并运行go build。

Boom - trivial cross-platform development.

跨平台开发。