All pastes #383802 Raw Edit

Untitled

public text v1 · immutable
·published 2007-03-06 16:58 UTC
rendered paste body
#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);
        }
}