Re: Detecting file change

Discussion in 'C Programming' started by Default User, Aug 20, 2003.

  1. Default User

    Default User Guest

    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
     
    Default User, Aug 20, 2003
    #1
    1. Advertising

  2. Default User

    Sven Semmler Guest

    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
     
    Sven Semmler, Aug 21, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nathan Sokalski

    Detecting a change in a file or directory

    Nathan Sokalski, Dec 4, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    449
    Vadym Stetsyak
    Dec 5, 2005
  2. jeff
    Replies:
    1
    Views:
    287
    =?ISO-8859-1?Q?Gerhard_H=E4ring?=
    Aug 16, 2003
  3. Erik  Bethke
    Replies:
    0
    Views:
    632
    Erik Bethke
    Feb 21, 2005
  4. Erik  Bethke
    Replies:
    1
    Views:
    380
    Do Re Mi chel La Si Do
    Feb 21, 2005
  5. =?Utf-8?B?TWVyZGFhZA==?=
    Replies:
    0
    Views:
    269
    =?Utf-8?B?TWVyZGFhZA==?=
    Oct 25, 2006
Loading...

Share This Page