在平常编程中经常遇到需要各种数据类型之间的转化,先做一个持续的归纳
1. CString转换为*char
CString str=_T("Hello World!");
char *outchar=new char[str.GetLength()];
outchar=(char*)(LPCTSTR)str;
2. CString转化为String
CString str=_T("Hello World!");
char *outchar=new char[str.GetLength()];
outchar=(char*)(LPCTSTR)str;
String text(outchar);
最后
以上就是勤恳牛排最近收集整理的关于C、C++、MFC中各类数据类型的转化(持续更新中)的全部内容,更多相关C、C++、MFC中各类数据类型内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复