No Description

rexim dbb5e7eb1d Put header include guards completely inside of _WIN32 check 2 years ago
.github 3c6603fbbd Simplify minirent consumption 3 years ago
examples 3c6603fbbd Simplify minirent consumption 3 years ago
.gitignore f8cbbc30c0 Add .gitignore 4 years ago
LICENSE 8c7af0322c Ready. Set. Go! 4 years ago
README.md 3c6603fbbd Simplify minirent consumption 3 years ago
minirent.h dbb5e7eb1d Put header include guards completely inside of _WIN32 check 2 years ago

README.md

Build Status

minirent

A subset of dirent interface for Windows.

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

Use minirent as a cross-platform replacement of dirent if you only need the subset interface.

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>

#define MINIRENT_IMPLEMENTATION
#include <minirent.h>

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.