There must be an easy way to do this...
// C# code
for (int i = 0; i < 20; i++)
doSomething(i.ToString() + "_file.bmp");
I'm trying to do this in C++, but it turns out that the simplest things are the hardest to do in that language. Mostly because there's a catch: I'm restricted to a library that only takes char*
's as the parameter for the function this will eventually end up in, so I'm pretty much stuck playing with char
arrays. This is what I have so far:
char* path[12];
for(int i = 0; i < 20; i++)
{
sprintf(path[0],"%i_Card.bmp",i);
cards[i] = new Card(i,path[0]);
}
The problem is, this approach ends me up with one big, long, useless string.
I must disclose that this is for a school assignment, but answering this question will not decide my grade, it will just make one aspect of the app a little easier.