Archived

This topic is now archived and is closed to further replies.

Kaezin

String question

Recommended Posts

Alright I wanna load dome1.bmp, dome2.bmp, and dome3.bmp, and I want to do it in a loop. How do I do that? I''ve done it before but I don''t remember how. It was something like:
for(int iCounter=0;iCounter<=3;iCounter++)
    LoadBMP(strcat(strcat("dome",iCounter)),".bmp");
 
I doubt it is strcat, I don''t even know what I''m saying because this is all off the top of my head. Can anyone help me?

Share this post


Link to post
Share on other sites
I have no idea what this load BMP function is. It's not function VC++ help recognizes, so I'll assume it came from somewhere else. Because of that, I'm going to have to sum it up like this. Please note I have no idea how this LoadBMP function works, so you may have to change the call to it.

for (int loop = 1; loop < 4; loop++){
char name[100]; sprintf(name,"dome%d.bmp",loop);
LoadBMP(name);
}

strcat appends the second string to the first, and I really don't see the need for it if the only part that's changing is the number. If you did want to use those nested strcat functions, however, you'd have to do something about that iCounter, simply because that's an integer, not a string. Using that number would have incorrect output.

Hope this helps!

-Arek the Absolute

[edited by - Arek the Absolute on July 28, 2002 8:19:33 PM]

Share this post


Link to post
Share on other sites