For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > February 2007 > to verify if the file is refreshing









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author to verify if the file is refreshing
pawan_test

2007-02-28, 4:07 am

Hi All,

I have a text file. before processing the file i have to verify of the
file is refreshing .
if the file is not refresing then i have to process it.

can you please let me know how do i check if the file is refreshing .

Thanks
mark

Ian Collins

2007-02-28, 4:07 am

pawan_test wrote:
> Hi All,
>
> I have a text file. before processing the file i have to verify of the
> file is refreshing .
> if the file is not refresing then i have to process it.
>
> can you please let me know how do i check if the file is refreshing .
>

How do you define 'refreshing'?

Do you control both the reader and the writer to the file? If so, you
could use flock().

--
Ian Collins.
Beej Jorgensen

2007-02-28, 4:07 am

Ian Collins <ian-news@hotmail.com> wrote:
>pawan_test wrote:
>How do you define 'refreshing'?


Cool. Crisp. Clear.

Ahhh, that's a refreshing file.

-Beej

Jens Thoms Toerring

2007-02-28, 4:07 am

pawan_test <sridhara007@gmail.com> wrote:
> I have a text file. before processing the file i have to verify of the
> file is refreshing .
> if the file is not refresing then i have to process it.


> can you please let me know how do i check if the file is refreshing .


If "is refreshing" got something to do with the date of the last
modification of the file take a look at the stat(2) function, it
fills in a structure that has a member called 'st_mtime' which is
the date of the last modification of the file. Hopefully you don't
need a resolution of higher than 1 second.

Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com