Checking a file to see if its changed? 
Author Message
 Checking a file to see if its changed?

Hello

Been doing a bit of reading about this on whatever sites I can find on the
'net, but I don't really seem to be able to find a clear solution ..

I've got a program from a 3rd party that generates a log file..  I would
like to read the changes that are made to the log file...

The solution I had thought of involves a timer of sorts..  store the size of
the file, wait for the timer event, check the size of the file..  if it has
changed, read the file..

Is there an easier way?

Thanks...



Thu, 15 Sep 2005 23:00:06 GMT  
 Checking a file to see if its changed?

Quote:

> Hello

> Been doing a bit of reading about this on whatever sites I can find on the
> 'net, but I don't really seem to be able to find a clear solution ..

> I've got a program from a 3rd party that generates a log file..  I would
> like to read the changes that are made to the log file...

> The solution I had thought of involves a timer of sorts..  store the size of
> the file, wait for the timer event, check the size of the file..  if it has
> changed, read the file..

> Is there an easier way?

> Thanks...

There are two ways to receive notifications from the OS when a file
changes.  If you know the exact file name the
FindFirstChangeNotification API is easiest.  If you don't know the file
name ReadDirectoryChangesW is more useful.

--
Scott McPhillips [VC++ MVP]



Thu, 15 Sep 2005 23:46:10 GMT  
 Checking a file to see if its changed?

Quote:
>Is there an easier way?

Tim,

You may be able to use FindFirstChangeNotification or
ReadDirectoryChangesW. Whether they would be easier remains to be
seen!

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq



Thu, 15 Sep 2005 23:58:25 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Checking for file change

2. checking to see if file has changed

3. Change file -> change timestamp of file

4. making #define's to be seen across files

5. gcc g++: File.h for gcc - did you ever seen

6. Imported CPP files not seen in Classview?

7. remote debugger + seeing source files

8. Seeing 2 or more files

9. Seeing default .resx file in Solution view

10. Anyone seen this: fatal error CS0013: Unexpected error writing metadata to file

11. Check the file size and number symbols in a file using C in Unix

12. EOF file checking for Txt file

 

 
Powered by phpBB® Forum Software