Inotify Example - Introduction to Inotify with a C Program Example

2010-05-24 1 min read C Programs Learning Linux
<a href="">Inotify Example: Introduction to Inotify with a C Program Example: <a class="zem_slink freebase/en/inotify" href="" title="Inotify" rel="wikipedia">inotify utility is an effective tool to monitor and notify <a class="zem_slink freebase/en/file_system" href="" 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="" title="Library" rel="wikipedia">library is used by various other programs. For example, <a class="zem_slink freebase/en/cpan" href="" 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