Why does program crash when an integer variable is declared in main
so is there any way to convert a string to a number and decrement the number and change it back to a string? |
I'm curious as to why you convert from a string and back again? typically, you would create the string for output.
1 2
|
#include <stringstream>
#include <string>
|
1 2 3 4 5 6 7 8 9 10 11
|
int someVal = 7;
someVal--;
// build a string
ostringstream output;
output << "someVal == " << someVal << ", yadayada: " << 101; // much like you would use cout.
output.str() // returns a std::string
output.str().c_str() // returns a const char *
// RenderText(... , output.str().c_str(), ...)
|
Topic archived. No new replies allowed.