I've done some searching here but I think I can't articulate what i'm looking for so here's my post:
I've got multiple files with similar names that I want to open and display in my console one after the other. These files are ascii images that when displayed in order create an animation
the file names are:
- 8ball1.txt
- 8ball2.txt
- 8ball3.txt
- 8ball4.txt
I want to use the 'int' declaration in the for loop to open the next file in the list every time the loop executes
Hopefully the code below makes sense - Can i partially complete a file name using the for loops int declaration? Is there an alternative?
void animate2() {
for (int x = 1; x < 5; x++) {
ifstream animation("8ballanimation//8ball<<x<<.txt");
while (!animation.eof())
{
string displayFile;
getline(animation, displayFile);
cout << displayFile << endl;
}
animation.close();
Sleep(150);
system("CLS");
}
}