I would like to create a C program that retrieves the inode information of a file (or a directory file) and put it as a parameter and display the file creation date but I have a segmentation problem. I don't know how to fix it. PS: I should use Ctime.
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char * argv[]) {
struct stat *buffer = NULL;
buffer = malloc(sizeof(struct stat));
stat (argv[1],buffer);
printf("Date de création du fichier: %s", ctime(&buffer->st_ctime));
printf("Numéro inode: %ld\n", buffer->st_ino);
return 0;
}