There are around 200 text files of test results in a folder that I want to read them one by one and extract data that I want.
These file have standard name structure, e.g id + date.
I have searched on this forum, but what they want to do is rather simple, and can be done by storing an array of name manually in code. However, I don't think it is the best way for my application.
I have idea of how the steps should be, but I have no idea how to implement it with C++, so here is what I think I should do
1. Have a function to get a list of the file in the folder
2. Store all these names in an array
3. Using a loop function, reading the text file by fstream with argument from these name array, one by one.
4. Ideally I may do a check before passing the argument into fstream, e.g. if the extension name, the last three characters are not 'txt', then I pass this name.
5. I do whatever I do with this text file as usual
6. When I finish with this file, go back into the loop and start the next one.
And now, what I am struggling, is the very first step, how to get a list of the file name in a folder.
if you know the general name of the files,you may try to get to use a double variabled for loop to set the names of the files in a character pointer string.....