I recommend using the std::string class like RedEye suggested, but here are some helper functions that I wrote for my project which you might find useful.
Includes:
#include <string>
#include <stringstream>
using std::string;
Functions (put this at the top of the source file or tucked in a header file somewhere):
// toStr
// convert a value to a string
template <class T> string toStr( T &value )
{
std::ostringstream ss;
ss << value;
return ss.str();
}
// fromStr
// convert a value from a string
template <class T> T fromStr( string &str )
{
T value;
std::istringstream ss( str );
ss >> value;
return value;
}
// castStr
// casts a std::string to a char ptr, use this to pass strings into gdk commands when it expects a char *
char *castStr( const string &str )
{
return const_cast<char *>( str.c_str() );
}
and this is how you would use them:
dbText( 0, 0, castStr( "Hello World! " + toStr( someNumber ) ) );
and
float myNumber = fromStr<float>( "3220.0" );