View Full Version: Reading a whole directory

C++ Learning Community > Other Programing Languages > Reading a whole directory


Title: Reading a whole directory
Description: Lots of fun in C


feldmarschall - February 5, 2007 01:28 AM (GMT)
So I have a directory of something like 1600 files, and I need to put all their filenames into one big list in a text file.

All I need now is to figure out how to grab all the filenames from the directory, then I can fprintf them all into my text list.

Any suggestions? Been looking through google and havent found anything helpful..I'll try some more.

And it needs to grab the full name blahblah.crap, etc.

yankees26 - February 5, 2007 03:04 AM (GMT)
You could try using Boost if this is in C++ or if its C or C++ then you could use dirent.h http://www.informit.com/guides/content.asp...seqNum=245&rl=1

But I am not sure how supported dirent.h is.

feldmarschall - February 5, 2007 08:32 AM (GMT)
Well I suppose I could do it in a separate C++ project on my box here and then translate the results into the game.

Is boost difficult to use? And what functions in should I be looking at?

yankees26 - February 8, 2007 11:14 PM (GMT)
I've never actually used boost for this stuff, but take a look at boost::filesystem documentation at boost.org.




Hosted for free by InvisionFree