I am trying to convert an int to a string for a small game I am making to learn SDL. As this question is asked three or four times aday, I looked through a few old posts and decided to go like:
//int Life;
//std::string Health;
//std::stringstream ss;
ss << Life;
Health = ss.str();
But, as this portion of code is repeated, 'Life' gets added to 'ss' instead of just placed there. So, I can fix this in two different ways: clearing 'ss', or doing something like:
ss = Life;
Health = ss.str();
How can I do either? I know nothing of stringstream.