知识严重贫瘠~

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:

 

评分:0

我来说两句

日历

« 2024-05-03  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 15631
  • 日志数: 11
  • 建立时间: 2010-05-31
  • 更新时间: 2010-07-22

RSS订阅

Open Toolbar