February 23, 2010 at 7:23 am #3611
Straight way you can not check the file is read or not.
For specific number of days or epoch seconds you can check
Here I have written the program for checking file is read in last 2 days
struct stat but ;
// Here you need to give the file name with absolute path.
// Here I have calculated the one day epoch time.
int limit = 24*60*60;
// Getting the last read time of the file.
int read = but.st_atime ;
int current ;
// Getting the current epoch time.
current=time ( NULL ) ;
// Check file is not open for 2 days.
if (((current-read)/limit) >= 2 )
printf ( "file is not read ");
printf ( "file is read " ) ;