如何使用C ++监视文本文件的更改?难度:否.NET [英] How do I Monitor Text File Changes with C++? Difficulty: No .NET

查看:71
本文介绍了如何使用C ++监视文本文件的更改?难度:否.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用例:第三方应用程序希望以编程方式监视由另一个程序生成的文本文件.文本文件包含您要在更新时分析的数据.

Use case: 3rd party application wants to programatically monitor a text file being generated by another program. Text file contains data you want to analyze as it's being updated.

对于围绕FileSystemWatcher的此问题,我发现了很多答案,但是,假设您正在为Windows计算机编写应用程序,并且不能保证已安装.NET.

I'm finding a lot of answers to this question wrapped around FileSystemWatcher but let's say you are writing an application for a Windows machine and can't guarantee .NET is installed.

这里是否有可用的库,或者我只是不得不推出自己的解决方案?

Are there any libraries out there available for this, or am I just going to have to roll my own solution then?

谢谢.

推荐答案

您可以使用 FindFirstChangeNotification 可在任何窗口上使用.
如果您知道文件在哪里,这很有效-否则,您可以使用下面描述的虚拟驱动程序/Filemon来检查系统上任何位置的更改.

You can monitor a directory with FindFirstChangeNotification works on any windows.
It's efficent if you know where the file is - otherwise you can use the virtual driver/Filemon described below to check for changes anywhere on the system.

示例代码此处

这篇关于如何使用C ++监视文本文件的更改?难度:否.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆