Something like this (untested)
while ( 1 ) {
while ( fgets(line,size,fp)!=NULL) {
// process lines
}
clearerr( fp ); // reset end of file flag
sleep( 1 ); // wait for more lines to arrive
}
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
Oh, thanks for the update, be sure to add more information later.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
does fgets() gets aware when a file is updated ?
will clearerr( fp ) tell fgets() that EOF has not been reached?
If the above method is not working then you must go for closing and reopening of the file when it gets updated
ajay.krish123
Junior Poster in Training
90 posts since Nov 2008
Reputation Points: 6
Solved Threads: 9
And did you assign the result of fopen ?
And please learn how to use code tags.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
Well I guess you'll just have to post your real code, and not just random bits of pseudo-code.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953