0

I am working on making a linux c++ project compile and run on Windows. I have run into some problems with sys/dir.h and am struggling to find a windows equivalent. Does anyone know the most similar Windows library in terms of functionality?

I have looked around online and can't find a solid solution. Thanks for your help!

JKola1042
  • 13
  • 2
  • 3
    C++ has `std::filesystem` for interacting with the filesytem. Trying to find a direct code-compatible header is asking for trouble. – Botje Jun 05 '23 at 12:57
  • what are you using from `sys/dir.h` that you need to port to windows? – Alan Birtles Jun 05 '23 at 12:58
  • Some potential 'drop-in' replacements here: https://stackoverflow.com/questions/883594/microsoft-visual-studio-opendir-and-readdir-how – Paul Sanders Jun 05 '23 at 13:00
  • @AlanBirtles I need to use openDir, closeDir, readDir, and rewindDir, mainly. – JKola1042 Jun 05 '23 at 13:15
  • `NtOpenFile`, `NtClose`, `NtQueryDirectoryFile` – RbMm Jun 05 '23 at 13:30
  • For Winapi (not NT native API), `FirstFirstFile` / `FindNextFile`. Example: https://learn.microsoft.com/en-us/windows/win32/fileio/listing-the-files-in-a-directory – Ben Voigt Jun 05 '23 at 15:24

0 Answers0