C++ create string of text and variables
Have you considered using stringstreams?
#include <string>
#include <sstream>
std::ostringstream oss;
oss << "sometext" << somevar << "sometext" << somevar;
std::string var = oss.str();
In C++11 you can use std::to_string:
std::string var = "sometext" + std::to_string(somevar) + "sometext" + std::to_string(somevar);