The std::string::append() method expects its argument to be a NULL terminated string (char*).
std::string::append()
char*
There are several approaches for producing a string containg an int:
string
int
std::ostringstream
#include <sstream> std::ostringstream s; s << "select logged from login where id = " << ClientID; std::string query(s.str());
std::to_string (C++11)
std::to_string
std::string query("select logged from login where id = " + std::to_string(ClientID));
boost::lexical_cast
#include <boost/lexical_cast.hpp> std::string query("select logged from login where id = " + boost::lexical_cast<std::string>(ClientID));
2.1m questions
2.1m answers
60 comments
57.0k users