How to read all files in a folder using C
===

I wish to read all the text files in a particular folder. The files' names do not have any common pattern in them- else the task would have been easier.
    
    //read a file from the directory  
    //Perform a common operation  
    //write output to a common file  
    //read the next file


It will be good if I could work around with sub-folders as well, but even the basic implementation is sufficient.

I tried looking at the previously asked related questions ([here][1], [here][2], [here][3] and [here][4]), but none of them give a C and Linux specific answer which I need. 

[1]:http://stackoverflow.com/q/2918579/1295278
[2]:http://stackoverflow.com/q/1844688/1295278
[3]:http://stackoverflow.com/q/5840443/1295278
[4]:http://stackoverflow.com/q/5426398/1295278