知识严重贫瘠~
Char, TChar 和 int之间的转换
上一篇 /
下一篇 2010-07-22 11:43:29
/ 个人分类:C++
atoi是char类型到int,itoa是int类型到char。
_wtoi是tchar到int,_itow/_itow_s是int到tchar。
{
int num1,num2,num3;
TCHAR ch1[10],ch2[10],ch3[10];
//LPTSTR c1,c2,c3;
GetDlgItem(IDC_EDIT1)->GetWindowText(ch1,10);
GetDlgItem(IDC_EDIT2)->GetWindowText(ch2,10);
num1=_wtoi(ch1);
num2=_wtoi(ch2);
num3=num1+num2;
_itow_s(num3,ch3,10);
GetDlgItem(IDC_EDIT3)->SetWindowText(ch3);
}
收藏
举报
TAG: