Нет описания

Alexey Kutepov c08ac78183 Merge pull request #1 from tsoding/0.0.1 5 лет назад
.github b62d363133 Fix the include path in MSVC build 5 лет назад
examples 730c3ba45e Include assert.h in minirent.h 5 лет назад
.gitignore f8cbbc30c0 Add .gitignore 5 лет назад
LICENSE 8c7af0322c Ready. Set. Go! 5 лет назад
README.md 8f2a7c6414 Fix dirent spec link 5 лет назад
minirent.h afd6d070f0 [0.0.1] First Official Release of minirent 5 лет назад

README.md

Build Status

minirent

A subset of dirent interface for Windows.

The code that works with minirent must work with the dirent.

Usage

minirent.h is an stb-style header-only library. That means that when you just include it it does not include the implementations of the functions. You have to define MINIRENT_IMPLEMENTATION macro:

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

#ifdef _WIN32
#    define MINIRENT_IMPLEMENTATION
#    include <minirent.h>
#else
#    include <dirent.h>
#endif // _WIN32

int main(void)
{
    DIR *dir = opendir(".");
    assert(dir);

    errno = 0;
    struct dirent *dp = NULL;
    while ((dp = readdir(dir))) {
        printf("%s\n", dp->d_name);
    }
    assert(errno == 0);

    int err = closedir(dir);
    assert(err == 0);

    return 0;
}

For more information see ./examples/ folder.