首页 > 技术文章 > int类型转string类型c++

happyamyhope 2017-08-21 09:46 原文

前言

 使用VS的过程中,经常会用到需要将int类型数据转换为字符串类型,便于显示信息等.

实现方法

c++11标准中的to_string函数,在VS安装文件的include文件中生成的只读文件,使用起来非常方便。

目录是:.\vs2013\VC\include;

参考实例

    root.info("Begin to exit...");
    int bRet1;
    cout << llRealHandle << endl;
    root.info(to_string(llRealHandle).c_str());
    if (NET_DVR_StopRealPlay(llRealHandle))
    {
        bRet1 = NET_DVR_GetLastError();
        root.info(to_string(bRet1).c_str());
        cout << bRet1 << endl;
    }
    llRealHandle = -1;
View Code

参考:

1.http://blog.csdn.net/chavo0/article/details/51038397

2.http://blog.csdn.net/hobbit1988/article/details/7935546

推荐阅读