Skip to content

Instantly share code, notes, and snippets.

@asterite
Created February 8, 2015 13:24
Show Gist options
  • Save asterite/993519d1120186f7da9b to your computer and use it in GitHub Desktop.
Save asterite/993519d1120186f7da9b to your computer and use it in GitHub Desktop.
#include <dirent.h>
#include <stdio.h>
int main() {
DIR *dirp;
struct dirent *dp;
dirp = opendir(".");
if (dirp == NULL)
return (1);
while ((dp = readdir(dirp)) != NULL) {
printf("%s %d\n", dp->d_name, dp->d_type);
}
closedir(dirp);
return (0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment