How to convert uint64_t to const char * in C++? -
i have 1 method accepts const char *
shown below -
bool get_data(const char* userid) const;
now below loop in need call get_data
method passing const char *
. below loop uses uint64_t
. need convert uint64_t
const char *
, pass get_data
method.
for (tmpidset::iterator = userids.begin(); != userids.end(); ++it) { // .. code // convert const char * mpl_files.get_data(*it) }
here tmpidset
typedef std::set<uint64_t> tmpidset;
so question how should convert uint64_t
in above code const char *
?
one way convert first std::string
using std::to_string , access raw data using std::string::c_str()
member function:
#include <string> .... uint64_t integer = 42; std::string str = std::to_string(integer); mpl_files.get_data(str.c_str());
Comments
Post a Comment