17 lines
398 B
C
17 lines
398 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
|
|
int main(int argc, char* argv[]) {
|
|
struct stat buffer;
|
|
if (argc < 2) {
|
|
puts("Veuillez préciser un fichier.");
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
stat(argv[1], &buffer);
|
|
printf("La taille de %s est de %d octets.\n", argv[1], buffer.st_size);
|
|
return EXIT_SUCCESS;
|
|
} |