将boost :: uuid转换为char * [英] Convert boost::uuid to char*

查看:167
本文介绍了将boost :: uuid转换为char *的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望将boost :: uuid转换为const char *.转换的正确语法是什么?

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

推荐答案

您可以通过使用boost :: lexical_cast并在后台使用std :: stringstream来简化此操作.

You can do this a bit easier using boost::lexical_cast that uses a std::stringstream under the hood.

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

const std::string tmp = boost::lexical_cast<std::string>(theUuid);
const char * value = tmp.c_str();

这篇关于将boost :: uuid转换为char *的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆