kolibrios/contrib/kolibri-libc/tests/test_dirent.c
Magomed Kostoev (mkostoevr) 1f4d74f500 Relocate kolibri-libc from GitHub
git-svn-id: svn://kolibrios.org@8622 a494cfbc-eb01-0410-851d-a64ba20cac60
2021-03-02 17:58:11 +00:00

21 lines
439 B
C

#include <ksys.h>
#include <sys/dirent.h>
#include <stdlib.h>
int main(int argc, char** argv)
{
DIR *dir;
struct dirent *entry;
dir = opendir("/sys");
if (!dir) {
_ksys_debug_puts("diropen error!\n");
return 0;
};
while ((entry = readdir(dir)) != NULL) {
_ksys_debug_puts(entry->d_name);
_ksys_debug_putc('\n');
};
_ksys_debug_puts(itoa(telldir(dir)));
closedir(dir);
}