how to tell when a file is modified by other programs

Good Morning,
I'm using wxWidgets to make a gui that writes a text file. It also has the ability to load in pre-written files. the file extension is .in . The in/output is all done with ofstreams and ifstreams. What I'm wondering is, is there a way to detect when a file has been altered by another program or is open in another program? Notepad++ for example, has a reload message when files are modified by another program. Can i do this in a simple way using the stream class or related objects? I've looked through the documentation and couldn't find any flags of the kind "no access to other programs" or anything. I do know that when a .csv file is open in excel, the fail bit is set for a stream. This does not happen when the same file is open in notepad, but that would be the kind of thing I'm looking for.
Many thanks in advance,
Gilly
Last edited on
There are OS specific solutions, there isn't a general solution.

By mentioning Notepad++, I take it you mean Windows. Here's an MSDN example:
http://msdn.microsoft.com/en-us/library/aa365261%28v=vs.85%29.aspx
thanks for the reply,
I was looking for a platform independent solution actually, hence the desire to use C++ stream classes. But if it can't be done, it can't be done.
Many thanks,
Gilly
RedHat Linux 8 introduced the File Alteration Manager. It dramatically reduced the performance of the GUI, but that was a long time ago; it has to be better now.

If you want a Linux solution, here is is:
http://oss.sgi.com/projects/fam/
thanks again
Topic archived. No new replies allowed.