Convert boost::uuid to char*

SchwartzE picture SchwartzE · Aug 10, 2010 · Viewed 28k times · Source

I am looking to convert a boost::uuid to a const char*. What is the correct syntax for the conversion?

Answer

SkorKNURE picture SkorKNURE · Sep 15, 2015

Just in case, there is also boost::uuids::to_string, that works as follows:

#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>

boost::uuids::uuid a = ...;
const std::string tmp = boost::uuids::to_string(a);
const char* value = tmp.c_str();