Traversing a directory tree in C++
Please take a look at http://en.wikipedia.org/wiki/Dirent.h
The reference also has a link to dirent.h implementation for Windows or you can use cygwin
If you want to just do it for Windows you can build upon this example
http://msdn.microsoft.com/en-us/library/aa365200%28VS.85%29.aspx
There are no standard filesystem functions, so you won't get any answers that use "plain C++". For POSIX systems, opendir is used. For Windows, FindFirstFile. I'm not sure about other OSes.
There's a reason people recommend Boost Filesystem—it's portable and takes care of all these details for you.