posix-uefi/examples/04_dirent/dirent.c
2021-02-16 22:28:14 +01:00

21 lines
450 B
C

#include <uefi.h>
/**
* List directory contents
*/
int main(int argc, char **argv)
{
(void)argc;
(void)argv;
DIR *dh;
struct dirent *de;
if((dh = opendir("\\04_dirent"))) {
while ((de = readdir(dh)) != NULL) {
printf("%c %04x %s\n", de->d_type == DT_DIR ? 'd' : '.', de->d_type, de->d_name);
}
closedir(dh);
} else
fprintf(stderr, "Unable to open directory\n");
return 0;
}