Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
/*
What: filedates.c
Who: SamBones on Tek-Tips
When: Jan 21, 2009
Why: Print out stat() information for a file.
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
int main(int argc, char ** argv)
{
struct stat filestats;
if ( argc != 2 )
{
fprintf(stderr, "filedates: incorrect number of parameters!\n");
return( -1 );
}
if( stat(argv[1], &filestats) )
{
fprintf(stderr, "filedates: Couldn't get file stats for %s!\n", argv[1]);
return( -1 );
}
printf(" File Name: %s\n", argv[1]);
printf(" Size: %ld\n", filestats.st_size);
printf(" Last Access Time: %s", asctime(localtime(&filestats.st_atime)));
printf(" Last Mod Time: %s", asctime(localtime(&filestats.st_mtime)));
printf("Last Stat Chg Time: %s", asctime(localtime(&filestats.st_ctime)));
return(0);
}
/* EOF: filedates.c */