Sign in to follow this  
lordoftools

How can I scan a Windows Directory?

Recommended Posts

In one of my previous threads i asked many questions and most were answered but I wanted to create a spin off thread that was more specific. I need to find out how i can scan a windows directory and gain a cstring array of the contents. I don't mind platform specific code and if it makes things easier then please do give me platform specific coding. I am using Windows XP with MSVC++ but i'd prefer if the code would work on all windows machines 2000 and up. Thank you, I look forward to your input. -Lordoftools P.S. - How do i do source code flags so that i can put code into that source code window i see all the time.

Share this post


Link to post
Share on other sites
There are lots of ways really:

For basic Windows API/other MS specific use:
FindFirstFile and friends. Part of the normal Windows API.
_findfirst and friends. Part of Microsofts C runtime.

For portable normal C++ use:
Boost has a file/directory handling library.

For .NET use:
Check out Directory/DirectoryInfo in the System.IO namespace.

None of the above return a cstring array but translating what they do return into your target type is fairly straight forward.

Share this post


Link to post
Share on other sites
Alright i have heard of boost before and even went as far as including all the proper directories and such. So if that is an option then i may want to start with that. Can anyone give me either a piece of source code or maybe a tutorial/instructional site which will show me enough to get the hang of boost?

Thank you
-Lordoftools

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this