1234567
for (int i=0; i<someNumber; ++i) { string filename("a"); filename = filename + itoa(i); filename = filename + ".txt"; // Now the filename is a0.txt, or a1.txt, or a2.txt etc etc }