What you are most likely looking for is sprintf , which works like printf but returns cstring.So your code will be
string msg(sprintf( "Selected elements: %d, %d.", i, j ) )
Del>
EDIT
, . , .
std::string itostr( int i )
{
char temp[20];
std::sprintf( temp, "%d" i);
std::string out(temp);
return out;
}
+ .
string msg("Selected elements: " + itostr(i) + "," + itostr(j) + ".");