Jump to content
  • Advertisement
Sign in to follow this  
Thomo

Arrays of strings

This topic is 4544 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

I am trying to use an array of strings. I need to get the length of the string of ean array element. I need to use strings because I will be using the replace() method from the standard string library. This is what I have: const std::string buttons[18][2] = { {"string4", "a"}, {"string2", "b"}, {"string3", "c"},......etc for (int curr_button = 0; curr_button < num_buttons; curr_button++) { // get the lenth of the current button string iStrLen = buttons[curr_button][0].size(); } The program compiles but crashes, I think on the size() method..What am I doing wrong, please???

Share this post


Link to post
Share on other sites
Advertisement
Please ignore this....

I found my problem was that I was trying to use sprintf with a string...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!