Is there a way to print the directory tree with all files conta开发者_如何学编程ined ?
Yes, use the FindFirstFile and FindNextFile api. Use these recursively (or even better, using a stack) to find the entire directory structure. MSDN example
There is no portable mean for directory operations in std c++. If you have boost, use boost filesystem. Otherwise you could take a look, how it is implemented in some portable libraries like Qt, wxWidgets, boost.
If you want all directories and all files (including those where you don't have access rights for) you can use Change Journals. The drawback is that it's pretty complicated.
http://www.microsoft.com/msj/0999/journal/journal.aspx
http://www.microsoft.com/msj/1099/journal2/journal2.aspx
精彩评论