Placing a counter variable w/in double quotes
Posted on 1998-07-24
I'm a beginner at C++ with a project to complete where I have a variable amount of data output files (~100) I need to write to in my program. I originally had 100 files that I painstakinly typed out in a two-dimensional array format that I was able to systematically open each loop of 100 times for writing to. But now I need to fix the program so that I can have a variable amount of files, so I was wondering how I could create a loop to declare a varying amount of output files with a given name (such as File1.dat, File2.dat, . . . Filex.dat). My only thought was to somehow put a counter within the quotations of the array format ("File(counter).dat") but I have no knowledge on how to do this. Thank you for any help you can provide.