Cool hack so dirent function calls work on Windows
I recently discovered a really cool hack by Toni Rönkkö: he’s created a fully-workable implementation of dirent, the set of POSIX-compliant functions to let you cycle through the entries of a directory on a disk. It means you can now write code that calls opendir(), readdir(), and closedir(), among others, and all of it will just work on both Unix and Windows when you include his uce-dirent.h header. You no longer need to manually write separate code to call the Windows FindFirstFile and FindNextFile functions, or the MS-DOS equivalent _dos_findfirst and _dos_findnext.
Toni has collected into a single header all the extra effort you almost had to do yourself, Mr Portable Hacker Dude. 🙂
Comments Off on Cool hack so dirent function calls work on Windows