參考資訊:
https://www.ibm.com/docs/en/zos/3.1.0?topic=functions-opendir-open-directory
main.c
#include <stdio.h>
#include <dirent.h>
int main (int argc, char *argv[])
{
DIR *dir = NULL;
struct dirent *ent = NULL;
dir = opendir("/tmp");
while ((ent = readdir(dir)) != NULL) {
printf("%s\n", ent->d_name);
}
closedir(dir);
return 0;
}