質問

Possible Duplicate:
How do you get a directory listing in C?
Listing directory contents using C and Windows

How do you write a program which lists the directories recursively just like dir /s C:\ in the command prompt?

役に立ちましたか?

解決

You can call the Windows API FindFirstFile and FindNextFile to iterate in a directory and do it recursively on subdirectories. See the Example on MSDN.

他のヒント

To list file contents you can search a directory with these APIs:

You'll need to #include <windows.h>, that'll get you access to the Windows API. They're C functions and so compatible with C++. If you want "specifically C++", try searching for listing directories using MFC.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top