码迷,mamicode.com
首页 > 编程语言 > 详细

MFC-将CString转换成std::string

时间:2015-04-02 18:27:45      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:

//将CString转换成const char *
int stringLength =
::WideCharToMultiByte(CP_UTF8, NULL, video_path, wcslen(video_path), NULL, 0, NULL, NULL);
char* buffer = new char[stringLength + 1];
::WideCharToMultiByte(CP_UTF8, NULL, video_path, wcslen(video_path), buffer, stringLength, NULL, NULL);
buffer[stringLength] = ‘\0‘;
std::string path = buffer;
delete []buffer;

MFC-将CString转换成std::string

标签:

原文地址:http://www.cnblogs.com/457220157-FTD/p/4387382.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!