FIle Handling - Linux

This is a discussion on FIle Handling - Linux ; Hi, I am developing an application on Linux environment. My application is opening a file(say X) and read some configurations parameters from it and closing the file X and doing some functional processing. In the meantime if user modified/change the ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: FIle Handling

  1. FIle Handling

    Hi,

    I am developing an application on Linux environment. My application is
    opening a file(say X) and read some configurations parameters from it
    and closing the file X and doing some functional processing. In the
    meantime if user modified/change the file X , then my application
    should reopen the file X and agan reading the parameters and working
    furhter.

    now the problem how my application will come to know that the file has
    been modified or chaged.

    Does nybody knows how i can make my application know that teh
    particular file has beem changed.

    I will really appreciate an email with comments form you!

    Thanks,
    Munish Nayyar


  2. Re: FIle Handling

    emanshu wrote:
    > Hi,
    >
    > I am developing an application on Linux environment. My application is
    > opening a file(say X) and read some configurations parameters from it
    > and closing the file X and doing some functional processing. In the
    > meantime if user modified/change the file X , then my application
    > should reopen the file X and agan reading the parameters and working
    > furhter.
    >
    > now the problem how my application will come to know that the file has
    > been modified or chaged.
    >
    > Does nybody knows how i can make my application know that teh
    > particular file has beem changed.


    You could stat(2) it on appropriate occasions and see if the modification
    date has changed.


    > I will really appreciate an email with comments form you!


    No sir, no email.
    --
    Josef Möllers (Pinguinpfleger bei FSC)
    If failure had no penalty success would not be a prize
    -- T. Pratchett


  3. Re: FIle Handling

    emanshu wrote:
    > Hi,
    >
    > I am developing an application on Linux environment. My application is
    > opening a file(say X) and read some configurations parameters from it
    > and closing the file X and doing some functional processing. In the
    > meantime if user modified/change the file X , then my application
    > should reopen the file X and agan reading the parameters and working
    > furhter.
    >
    > now the problem how my application will come to know that the file has
    > been modified or chaged.
    >
    > Does nybody knows how i can make my application know that teh
    > particular file has beem changed.
    >
    > I will really appreciate an email with comments form you!
    >
    > Thanks,
    > Munish Nayyar
    >

    I guess you want to do the SIGHUP signal service automaticaly. In my
    opinion you should make a thread or signal handler servicing SIGIO
    signal. Please read the fnctl function description for details. System
    gives you a convenietnt mechanism of file access control.

    Regards

  4. Re: FIle Handling

    On Fri, 2006-07-14 at 04:34 -0700, emanshu wrote:
    > Hi,
    >
    > I am developing an application on Linux environment. My application is
    > opening a file(say X) and read some configurations parameters from it
    > and closing the file X and doing some functional processing. In the
    > meantime if user modified/change the file X , then my application
    > should reopen the file X and agan reading the parameters and working
    > furhter.
    >
    > now the problem how my application will come to know that the file has
    > been modified or chaged.


    On recent kernels you can use inotify:

    http://www-128.ibm.com/developerwork...l-inotify.html

    --
    Tristan Wibberley

    Any opinions are my own, and do not reflect those of my employer.



+ Reply to Thread