/* structure passed to the stat() system call, to get its results. */
struct stat file_status;
/* check the status information of file "foo.txt", and print its */
/* type on screen. */
if (stat("foo.txt", &file_status) == 0) {
if (S_ISDIR(file_status.st_mode))
printf("foo.txt is a directory\n");
if (S_ISLNK(file_status.st_mode))
printf("foo.txt is a symbolic link\n");
if (S_ISCHR(file_status.st_mode))
printf("foo.txt is a character special file\n");
if (S_ISBLK(file_status.st_mode))
printf("foo.txt is a block special file\n");
if (S_ISFIFO(file_status.st_mode))
printf("foo.txt is a FIFO (named pipe)\n");
if (S_ISSOCK(file_status.st_mode))
printf("foo.txt is a (Unix domain) socket file\n");
if (S_ISREG(file_status.st_mode))
printf("foo.txt is a normal file\n");
}
else { /* stat() call failed and returned '-1'. */
perror("stat");
}
# Pour vérifier le fichier maintenant
Posté par spotty . En réponse au message reconnaitre un nom de fichier. Évalué à 2.
Qu'est-ce qu'on dit ? Merci google :D