char *转换为字符串 [英] Conversion of char * to string
本文介绍了char *转换为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有人有一个想法如何将char *转换为字符串。实际上,我有一个函数,它返回值为char *,现在我需要存储/复制std :: string。
我尝试过类似
Does anyone have an idea how to convert char* to string. Actually, I have a function which returns value as char* and now i need to store/copy std::string. I have tried something like
char * sResult =(char *)malloc
std:string line;
line = line + sResult
感谢和问候,
Sam
Thanks and regards, Sam
推荐答案
如何
std::string line(szResult);
这篇关于char *转换为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文