June 24th, 2009, 07:11 PM
Populate array with filenames from relative folder
I need to know how I can pull filenames from a folder which is relative to the program (I change the program's location from time to time) The folder I need to look in is in the same folder as the .exe.
When looping to get the filenames I need to check the extension of the file, and make sure it finishes with .cfg and nothing else, if it finishes with something different, ignore it.
The filenames saved in the array should be just the name, no path, and it should not include the .cfg in it when in the array.
An alternative method would be to do system("dir/b > files.txt") in the folder and pull the filenames line by line from the textfile, excluding anything not finishing with .cfg, if it's easier this way.
Not too sure how to go about doing this.
June 25th, 2009, 03:42 AM
Re: Populate array with filenames from relative folder
These FAQs can give you a hand:
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.