Skip to content

Instantly share code, notes, and snippets.

@ozuma
Last active August 21, 2020 14:11
Show Gist options
  • Select an option

  • Save ozuma/cbb3952387894f44ab88254ebfa03499 to your computer and use it in GitHub Desktop.

Select an option

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