Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <dirent.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- int main ()
- {
- DIR * folder;
- struct dirent *entry;
- const char folder_name[] = ".";
- folder = opendir (folder_name);
- if (folder == NULL)
- {
- perror ("Unable to read directory");
- exit (-1);
- }
- while ((entry = readdir (folder)))
- {
- struct stat buffer;
- int status;
- status = lstat (entry->d_name, &buffer);
- if (S_ISREG(buffer.st_mode))
- printf ("Fichier %s\n", entry->d_name);
- }
- closedir (folder);
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement