‎08-11-2011 06:02 AM
Is their a way to load a file only when their is something changed in the file?
‎08-11-2011 06:13 AM - edited ‎08-11-2011 06:14 AM
What file are we talking about?
Text file, MS Office file, TDMS file, ... ...
Who saved/changed the file?
Can that system set the "Archive" bit of the file?
If yes you check the "Archive" bit and reset it.
Can you use the "last changed" time of the file?
‎08-11-2011 06:15 AM
@JoVMo wrote:
Is their a way to load a file only when their is something changed in the file?
Well you're going to have to read it in some form or another to see if 'something changed in the file'..
What about storing the old file's size in bytes and using the 'Get File size' function to return the current size of the file in bytes. If there's a difference between your stored value and the current value, then the size of the file has changed.
Of course this will only work if the file's size changes and will not work if your overwriting an existing file with similar data which may contain the same number of bytes.
Maybe you could provide some more details for futher solutions
‎08-11-2011 06:21 AM
One process saves the XML file. Another process loads that file. But continuous loading of the file, finally makes the system crash due to memory underrun.
‎08-11-2011 06:48 AM
The process that modified the XML file could also set the Archive bit of that file, right?
The other process then reads the Archive bit of the file.
The process that modfied the XML file could also create a small txt file with the name of the mofied XML file.
The other process then reads the small text file at a certain time interval instead of the XML file.
If you open and close the file correctly I don't see why you system would crash
‎08-11-2011 07:00 AM
I can't find how to set the archive bit...
‎08-11-2011 07:05 AM
Maybe you can start here
And also don't forget that "Google" is your friend!
To be honest I never did it using LV but even more using VB 🙂
‎08-11-2011 08:41 AM
Using the "File Exists" vi from OpenG you could work as follow:
1) Process A modifies the XML file
2) Process A create an empty file in the same folder called e.g. "ServiceMe.txt"
3) Process B uses the "File Exists" vi to check for the "ServiceMe.txt" file
4) If file exists process B can do what he needs to do
5) if file doesn't exists, process B can have a break
The "File/Directory Info" VI returns, among other things, the last lodification date.
Maybe you can use this?
‎08-18-2011 05:45 AM
The file created and writed to by process A is keeped alive the entire time. So the file exists the all process, it is just beeing updated by process A. The archive bit approach, looks complicated to implement for process A. Process A need to know when to set the bit. It's not set automatic by the filesystem.