• Advertisement
Sign in to follow this  

Arrays of strings

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