APL/Révisions/CM/taille.c

17 lines
398 B
C
Raw Permalink Normal View History

2022-01-25 12:00:33 +01:00
#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;
}