You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
690 B
33 lines
690 B
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
#include <errno.h>
|
|
#include <time.h>
|
|
#include <sys/wait.h>
|
|
#include <sys/stat.h>
|
|
|
|
void showFileInfos(char *fileName) {
|
|
struct stat infos;
|
|
|
|
if (stat(fileName, &infos) == -1) {
|
|
perror("stat");
|
|
exit(EXIT_SUCCESS);
|
|
}
|
|
|
|
printf("Nom : %s\nTaille en octets : %lld octets\nDate modif : %lld s\n", \
|
|
fileName, (long long) infos.st_size, (long long) infos.st_mtime);
|
|
|
|
}
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
if(argc != 2){
|
|
fprintf(stderr, "Usage : %s <pathName>\n", argv[0]);
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
|
|
showFileInfos(argv[1]);
|
|
|
|
return 0;
|
|
} |