im quite new to c++ and i ve only written bits of code for college as examples, but no full apps now i want to write something useful for a change.
i want to write a program to list whats in a directory with a command, like dir in dos, how would i list whats in a directory and check to see whether or not a directory is valid.
thanks a lot.
It would help a bit if you let us know what OS you are developing your app for and what compiler you will be using.
i'm developing in Windows XP and using ms Visual studio
I have the same problem, but I'm using Linux/g++!
Somebody told me I could do something like this for windows
You need to fill a WIN32_FIND_DATA struct with a call to FindFirstFile() and then iterate through the directory with FindNextFile() until it returns INVALID_HANDLE_VALUE. Each time FindNextFile() returns sucessfully the filename will be a member of the WIN32_FIND_DATA struct which you could use to fill an array. You'll need to include windows.h; search the boards/MSDN for an example if needed.