Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- code:
- #include <stdio.h>
- #include <dirent.h>
- int main(int argc, char *argv[]) {
- DIR *dir = opendir(argv[1]);
- struct dirent *entry = readdir(dir);
- while ((entry = readdir(dir)) != NULL) {
- printf("%s\n", entry->d_name);
- }
- closedir(dir);
- }
- output:
- Desktop
- Templates
- Videos
- .bash_logout
- .local
- .
- becomeEliteLinuxUser
- .cache
- ..
- Pictures
- .mozilla
- Music
- Downloads
- .face.icon
- .profile
- .config
- Documents
- Public
- .face
- .bash_history
- .var
Advertisement
Add Comment
Please, Sign In to add comment