Created
December 16, 2014 22:51
-
-
Save gmunoz/03a1853a873677f22e8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <time.h> | |
int main(int argc, char *argv[]) | |
{ | |
printf("Hello world\n"); | |
if (argc != 2) { | |
fprintf(stderr, "Usage: %s <pathname>\n", argv[0]); | |
exit(1); | |
} | |
struct stat sb; | |
if (stat(argv[1], &sb) == -1) { | |
perror("stat"); | |
exit(1); | |
} | |
printf("Last status change: %s", ctime(&sb.st_ctime)); | |
printf("Last file access: %s", ctime(&sb.st_atime)); | |
printf("Last file modification: %s", ctime(&sb.st_mtime)); | |
exit(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment