Inotify Example - Introduction to Inotify with a C Program Example

2010-05-24 1 min read C Programs Learning Linux
<a href="http://www.thegeekstuff.com/2010/04/inotify-c-program-example/">Inotify Example: Introduction to Inotify with a C Program Example: <a class="zem_slink freebase/en/inotify" href="http://en.wikipedia.org/wiki/Inotify" title="Inotify" rel="wikipedia">inotify utility is an effective tool to monitor and notify <a class="zem_slink freebase/en/file_system" href="http://en.wikipedia.org/wiki/File_system" title="File system" rel="wikipedia">filesystem changes. You can specify a list of files and directories that needs to be monitored by inotify. This <a class="zem_slink freebase/guid/9202a8c04000641f8000000000023d0f" href="http://en.wikipedia.org/wiki/Library" title="Library" rel="wikipedia">library is used by various other programs. For example, <a class="zem_slink freebase/en/cpan" href="http://www.cpan.org/" title="CPAN" rel="homepage">CPAN module Linux::Inotify is developed based on this library. Continue reading

Last access time for file

2010-02-03 1 min read C Programs Linux
The C program will print the last access time for the file. This is quite helpfull program when you want to find old files. Modifying the source to take the filename as argument and take multiple arguments is left as an exercise. #include <stdio.h> #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <time.h> #include <stdlib.h> int main(void) { char datestring[80]; struct stat a; //int fd = open("ak",O_RDONLY); if (stat ("iptc.c", &a) == -1) { Continue reading