-
-
Save kasramp/cce95df1e5a6466cc084e70aa6d1e5d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <dirent.h> | |
#include <stdio.h> | |
int main(int argc, char *argv[]) | |
{ | |
DIR *dir; | |
struct dirent *de; | |
if (argc > 1) | |
dir = opendir(argv[1]); /*your directory*/ | |
else | |
dir = opendir("."); /* Default: current path */ | |
while (dir) | |
{ | |
de = readdir(dir); | |
if (!de) | |
break; | |
printf("%s\n", de->d_name); | |
} | |
closedir(dir); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment