Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting data written to a file.

Status
Not open for further replies.

cwalshe

Programmer
May 28, 2001
84
IE
Hi there,

I have a small quiry.

Occasionally I will be writing a small amount of data to a text file. The data will be about 2kb. I would like a mechcanism that will detect when this data has been written and then to take the string from my text file and inport it into a VB app.

Thx in advance,

Cormac.
 
Hi,

The obvious thing would be to do it in the program that writes the file. If thats not possible, you'll have to make a program that check the file at a certain interval.
Get the time and date of the file using the filesytemobject and store it in a variable. Put a timer on a form, set the interval of the timer and in the code check the file date&time, compare it to the value stored in the variable. If the 2 differs, the file has been changed.

Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Its possible in C/C++, but I don't know about VB, haven't tried it (you may be able to set up a hook). What you need to do is get the windows message that tells you when the file/folder has changed (it's how explorer 'magically' updates its display).


See:
for an example (in C++).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top