Originally Posted by
tabstop
(and maybe an array of strings for the filenames).
Would something like this be suitable? This may sound a silly question but it seems like there are a million different ways to do everything in C++.
Code:
string filenames[3] = {"1.txt", "2.txt", "3.txt"};
Originally Posted by
Daved
Your while loop runs once per file, right?
Thanks for replying, I appreciate it, but basically I want to check for some stuff in each file later in the while loop, meaning that the while loop will run more than once per file.
Code:
Note that you could declare the ifstream before the loop and use open and close as tabstop suggested, but that is less clear and would likely require more work (like a call to clear() to clear previous failbit or eofbit flags).
Yeah I had some fun figuring this out earlier today (just kidding, I seriously appreciate your help anyway tabstop). Thanks for pointing that out all the same.