MFC中 CString与int的转化

it2022-05-09  41

int 转化为SCtring:

     int n = 123; 

     CString str;

     str.Format("%d",n); 

报错的话则改为:str.Format(_T("%d"),n); 或者 str.Format(TEXT("%d"),n); 即可

 

CString 转化为 int:

CString str("123");int n= _ttoi(str);

 

 

转载于:https://www.cnblogs.com/lxt287994374/p/3362507.html

相关资源:数据结构—成绩单生成器

最新回复(0)