<legend id='mdNcL'><style id='mdNcL'><dir id='mdNcL'><q id='mdNcL'></q></dir></style></legend>
    <bdo id='mdNcL'></bdo><ul id='mdNcL'></ul>
<tfoot id='mdNcL'></tfoot>

  • <i id='mdNcL'><tr id='mdNcL'><dt id='mdNcL'><q id='mdNcL'><span id='mdNcL'><b id='mdNcL'><form id='mdNcL'><ins id='mdNcL'></ins><ul id='mdNcL'></ul><sub id='mdNcL'></sub></form><legend id='mdNcL'></legend><bdo id='mdNcL'><pre id='mdNcL'><center id='mdNcL'></center></pre></bdo></b><th id='mdNcL'></th></span></q></dt></tr></i><div id='mdNcL'><tfoot id='mdNcL'></tfoot><dl id='mdNcL'><fieldset id='mdNcL'></fieldset></dl></div>

        <small id='mdNcL'></small><noframes id='mdNcL'>

      1. 如何让我的程序监视 C++ 中的文件修改?

        How do I make my program watch for file modification in C++?(如何让我的程序监视 C++ 中的文件修改?)

            <tbody id='RxlOY'></tbody>
              <bdo id='RxlOY'></bdo><ul id='RxlOY'></ul>

              <small id='RxlOY'></small><noframes id='RxlOY'>

            • <legend id='RxlOY'><style id='RxlOY'><dir id='RxlOY'><q id='RxlOY'></q></dir></style></legend>
              1. <i id='RxlOY'><tr id='RxlOY'><dt id='RxlOY'><q id='RxlOY'><span id='RxlOY'><b id='RxlOY'><form id='RxlOY'><ins id='RxlOY'></ins><ul id='RxlOY'></ul><sub id='RxlOY'></sub></form><legend id='RxlOY'></legend><bdo id='RxlOY'><pre id='RxlOY'><center id='RxlOY'></center></pre></bdo></b><th id='RxlOY'></th></span></q></dt></tr></i><div id='RxlOY'><tfoot id='RxlOY'></tfoot><dl id='RxlOY'><fieldset id='RxlOY'></fieldset></dl></div>

                <tfoot id='RxlOY'></tfoot>
                • 本文介绍了如何让我的程序监视 C++ 中的文件修改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  有很多程序,例如 Visual Studio,可以检测外部程序何时修改文件,然后如果用户愿意选择重新加载文件.在 C++ 中是否有一种相对简单的方法来做这种事情(不一定是平台无关的)?

                  There are a lot of programs, Visual Studio for instance, that can detect when an outside program modifies a file and then reload the file if the user wants chooses. Is there a relatively easy way to do this sort of thing in C++ (doesn't necessarily have to be platform independent)?

                  推荐答案

                  根据平台,有几种方法可以做到这一点.我会从以下选项中进行选择:

                  There are several ways to do this depending on the platform. I would choose from the following choices:

                  奇趣科技的 Qt 有一个名为 QFileSystemWatcher 的对象,它允许您监视文件和目录.我敢肯定还有其他跨平台框架也可以为您提供这种功能,但根据我的经验,这个框架效果很好.

                  Trolltech's Qt has an object called QFileSystemWatcher which allows you to monitor files and directories. I'm sure there are other cross platform frameworks that give you this sort of capability too, but this one works fairly well in my experience.

                  有一个名为 FindFirstChangeNotification 可以胜任.有一篇很好的文章,其中有一个名为 How to get an notification if change if change发生在指定的目录中,这将使您开始.

                  There is a Win32 api called FindFirstChangeNotification which does the job. There is a nice article which a small wrapper class for the api called How to get a notification if change occurs in a specified directory which will get you started.

                  如果您可以在 .NET Framework 中使用 C++/CLI,那么System.IO.FileSystemWatcher 是您选择的类别.微软有一篇很好的文章如何使用此类监控文件系统更改.

                  If you are ok using C++/CLI with the .NET Framework then System.IO.FileSystemWatcher is your class of choice. Microsoft has a nice article on how to monitor file system changes using this class.

                  FSEvents API 是 OS X 10.5 的新 API,功能非常齐全.

                  The FSEvents API is new for OS X 10.5 and very full-featured.

                  使用 inotify,正如亚历克斯在回答中提到的那样.

                  Use inotify as Alex mentioned in his answer.

                  这篇关于如何让我的程序监视 C++ 中的文件修改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What is inside .lib file of Static library, Statically linked dynamic library and dynamically linked dynamic library?(静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么?)
                  How do I load a C DLL from the SXS in Python?(如何从 Python 中的 SXS 加载 C DLL?)
                  Can Cython code be compiled to a dll so C++ application can call it?(Cython 代码可以编译成 dll 以便 C++ 应用程序可以调用它吗?)
                  Delay Loading DLLs(延迟加载 DLL)
                  Throwing C++ exceptions across DLL boundaries(跨 DLL 边界抛出 C++ 异常)
                  Loading a dll from a dll?(从 dll 加载 dll?)

                    • <bdo id='SRHx6'></bdo><ul id='SRHx6'></ul>

                          <tfoot id='SRHx6'></tfoot>
                            <tbody id='SRHx6'></tbody>

                            <small id='SRHx6'></small><noframes id='SRHx6'>

                          • <legend id='SRHx6'><style id='SRHx6'><dir id='SRHx6'><q id='SRHx6'></q></dir></style></legend>
                          • <i id='SRHx6'><tr id='SRHx6'><dt id='SRHx6'><q id='SRHx6'><span id='SRHx6'><b id='SRHx6'><form id='SRHx6'><ins id='SRHx6'></ins><ul id='SRHx6'></ul><sub id='SRHx6'></sub></form><legend id='SRHx6'></legend><bdo id='SRHx6'><pre id='SRHx6'><center id='SRHx6'></center></pre></bdo></b><th id='SRHx6'></th></span></q></dt></tr></i><div id='SRHx6'><tfoot id='SRHx6'></tfoot><dl id='SRHx6'><fieldset id='SRHx6'></fieldset></dl></div>