Jump to content
  • Advertisement

Archived

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

Kaezin

String question

This topic is 5804 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
My C++ teacher would be ashamed of me; I forgot about sprintf =P Thanks hehe
Btw it''s OpenGL

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!