Advertisement

Directory listing in VisualC?

Started by November 19, 2000 12:24 PM
2 comments, last by kadaf 24 years, 2 months ago
Until recently I''ve been programming using Watcom C++ (11.0). There I could get access to various functions like: opendir, readdir, closedir etc, by including the direct.h header file. This file is also present in Visual C++ (6.0), but the opendir/readdir/closedir functions do not exist .... My problem is: How can I read a directory using a wild-card, when using Visual C++??? Thanks. .. .
-- Rasmus Neckelmann
There are Windows API calls that do the same thing. FindFirstFile is one such example. I think those functions will call the Windows API to do the actual work. The main reason for using the standard ones are for portability. I find it hard to believe they are not there. The ultimate source though is the help files. Look in the index under opendir and see what they say about it.
Keys to success: Ability, ambition and opportunity.
Advertisement
In short, use FindFirstFile, etc. like LilBudyWizer. I just want to add a couple of things.

As filesystems, and the general organization of files can be very different across different OS''s, there is no standard C set of functions which accomplish this task as LilBudyWizer hinted at.

Any function(s) you use will be platform/compiler dependent, so there really is no platform independent way of doing file/directory browsing, except for wrapping around specific API''s and hiding the platform dependency as much as possible.



--------------------------
I guess this is where most people put a famous quote...
"Everything is funnier with monkey''''s" - Unknown
--------------------------I guess this is where most people put a famous quote..."Everything is funnier with monkey''s" - Unknown
Okay then. The FindFirstFile/FindNextFile stuff works fine, but the structure is way different from the opendir/readdir/closedir stuff... A LOT of code had to be rewritten.

But thanks anyway.

Rasmus Neckelmann.
-- Rasmus Neckelmann

This topic is closed to new replies.

Advertisement