Hello, i am trying to read many different files. The filename has to change to different numbers. It loops 25 times.

For example the first run i want it to ifstream myfile3 (npcs/npc1.txt); but the second run i want it to ifstream myfile3 (npcs/npc5.txt);

so lets say...

npcmapdata[1] = 1
npcmapdata[2] = 5
npcmapdata[3] = 35

I tried this, but i get the error message '+' : cannot add two pointers. I have tried converting it to a string but then i get tons of errors. I really need some help on how to accomplish this. thank you very much.

Code:
while (npcloop < 25)
{
npcloop++;
string account2 = "npcs/" + "npc" + npcmapdata2[npcloop] + ".txt";


				  ifstream myfile3 (account2.c_str());
				  if (myfile3.is_open())
				  {
					while (! myfile3.eof() )
					{
					  getline (myfile3,npc);
                                          etc etc
}

I know its very confusing, but basically i want my file reading loop to constantly change filenames to a number that i am holding in npcmapdata2 arrays.


Thank you very much for any help i receive