Looping thru file folders

How to loop through file folders/subfolders of a specified path to find the file names of files existing in C/VC++.
Objective :
To output a text file with all the file names of files existing in a specified folder. The program has to loop through the subfolders(if there are any) in the input path.
Please help.
[324 byte] By [sujaa3] at [2007-11-20 8:23:17]