Friday, October 19, 2012

How do I get the date a file was last modified?

below info was copied from www.jb.man.ac.uk/~slowe/cpp/lastmod.html for my reference in future
I wanted to be able to use the date that a file was last modified, to set the filename of another file. It took me quite a while to find out how to get hold of the date and it turns out that there are three dates on UNIX/Linux. You can use the stat()function.


#include <sys/stat.h>
 
#include <unistd.h>
 
#include <time.h> 

No comments: