Search code examples
cfilesystemsdirectoryc89cvi

How can i access directories in C90 without dirent.h?


i am working in LabCVI on the basis of C90.

The tanks at hand would be to find the absolute paths of "*.spec" files in the "..\data"" directory and subdirectories.

I am aware that there are explanationse how i can do this with dirent.h, but i need to do it without dirent.h. This (part I, part II ) tutorial is not what i am looking for. LabCVI does not feature the dirent header and i cannot import ist from the Internet because the dependencies of dirent.h are incompatible with LabCVI.

I plan to migrate to a better IDE/Language once i killed all dependencies to LabCVI, but i have to keep the code campatible to that day. So i cant use the directory utilities of LabCVI.

How can i work around this and get my directory access? (The Code will run on XP Machines.)


Solution

  • You can use FindFirstFile and similar functions to do this. Check this sample code for more details: http://msdn.microsoft.com/en-us/library/aa365200%28v=vs.85%29.aspx