Skip to content

Instantly share code, notes, and snippets.

@ozuma
Last active August 21, 2020 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozuma/cbb3952387894f44ab88254ebfa03499 to your computer and use it in GitHub Desktop.
Save ozuma/cbb3952387894f44ab88254ebfa03499 to your computer and use it in GitHub Desktop.
View Directory Entry.
#include <stdio.h>
#include <dirent.h>
int main(int argc, char *argv[])
{
DIR *dir;
struct dirent *dentry;
dir = opendir(argv[1]);
while (dentry = readdir(dir)) {
printf("d_ino:%8i, d_type:%2i, d_name:%s\n",
dentry->d_ino,
dentry->d_type,
dentry->d_name);
}
closedir(dir);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment