刘华世的官方博客

CString 转 int

复制代码
CString转int:非Unicode环境
CString str("1234");
char *ch = str.GetBuffer(str.GetLength());
int num = atoi(ch);
str.ReleaseBuffer();
int转CString:非Unicode环境
CString str;
int num = 1234;
str.Format("%d",num);
不建议使用(LPSTR)(LPCTSTR)这样的转换,不安全,错误率高。
复制代码

 

posted @   pythonschool  阅读(336)  评论(0编辑  收藏  举报
努力加载评论中...
刘华世的官方博客
点击右上角即可分享
微信分享提示