I am currently working on a project that involves a large number of files (>100000) all with similar file names. ie.(1foo.0001,...,1foo.1223... and 2foo.0001 and so forth). I need a way to be able to somehow obtain a list or an array containing all of these file names. The primitive file names will be passed into the program ./myprog -i 1foo 2foo, for example. Is there a function call in c or c++ that would perform a similar function to ls, but keep returning filenames until all of the files have been processed.