Untitled
public text v1 · immutable#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "dirent.h"
main()
{
DIR *dfd;
Dirent *dp;
struct stat stbuf;
if((dfd = opendir(".")) == NULL) {
fprintf(stderr, "Kan directory niet openen\n");
return 1;
}
while((dp = readdir(dfd)) != NULL) {
stat(dp->name, &stbuf);
if((stbuf.st_mode & S_IFMT) == S_IFDIR)
printf("%s\n",dp->name);
}
}