Somebody please please help me here
I am new to Unix and wanted to try on using command line arguments.
I am trying to write a program that would monitor a file and print something each time the file changes.
The problem is when I am exeuting the file with
a.out monitored_filename
it doesnt show me anything on the screen. I am not aware of how should I change the monitored_file so that it follows the loop and prints something. I tried to search it in the Unix book , but couldnt find anything.
----------------------------------------------------------------------------
if(fstat(filedes,&stbuf) == -1)
{
printf("couldnt stat \n");
exit(1);
}
for(;

{
if(stbuf.st_mtime != last_time)
printf("file modified");
last_time = stbuf.st_mtime;
sleep(60);
fstat(filedes,&stbuf);
}
}