Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: Detecting file change

Reply
Thread Tools

Re: Detecting file change

 
 
Default User
Guest
Posts: n/a
 
      08-20-2003
Sven Semmler wrote:
>
> Usenet Soton wrote:
>
> > In a C program I want to run a routine each time a certain file is
> > changed on the disk. This file will be written by another program
> > independently. How can I do this?

>
> Using ANSI/ISO C you have no choice but to poll the file regulary. Your OS
> may support different approches but that would be off-topic here.



What do you mean by "poll"? The only way using ANSI/ISO C is to either
have an indicator in the file or to examine the entire file against a
stored reference, either a copy of the file or the file contents stored
in memory.




Brian Rodenborn
 
Reply With Quote
 
 
 
 
Sven Semmler
Guest
Posts: n/a
 
      08-21-2003
Default User wrote:

> What do you mean by "poll"? The only way using ANSI/ISO C is to either
> have an indicator in the file or to examine the entire file against a
> stored reference, either a copy of the file or the file contents stored
> in memory.


Well, one could also think about a checksum and/or the file length. Sure,
to make it simple and 100% working you have no choice, but to compare to
an internal copy or use POSIX.

/Sven

--
Sven Semmler http://www.semmlerconsulting.com/
GPG Fingerprint: 72CA E26D C2A3 1FEB 7AFC 10EA F769 A9A4 937F 5E67
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A Paradise DNS address change? What change? There was no change. Tony Neville NZ Computing 7 09-22-2006 01:02 PM
Detecting a change in a file or directory Nathan Sokalski ASP .Net 3 12-05-2005 05:22 PM
detecting the change in desktop resolution - how? Erik Bethke Python 1 02-21-2005 05:15 PM
Detecting the change of screen resolution with SDL or PyGame Erik Bethke Python 0 02-21-2005 02:30 PM
detecting -addition, deletion or change to files jeff Python 1 08-16-2003 01:43 PM



Advertisments