Visual C + + Learning Note 1: Be sure to note the ANSI and Unicode differences

Source: Internet
Author: User

Recent research VC + +. Download VS2013, according to "Visual C + + Development Combat series" First Hello I wrote a regular sample, the results show garbled edit box. The night has been a toss-up change. It then summarizes the apparent ANSI and Unicode differences.

When the old tutorial just came out, these control interfaces are in ANSI format, and now they are all unified into Unicode.

Reprint Please specify:http://blog.csdn.net/sadshen/article/details/46405637

void Chellodlg::onbnclickedok ()
{
CString Csplus; Defining string variables
CString Cssummand;
M_plusnumber.getwindowtext (Csplus); Gets the text in the edit box control
M_summand.getwindowtext (Cssummand);


int nplus = _wtoi(csplus);//atoi (Csplus.getbuffer (0)); Convert the text of an edit box to an integer
Csplus.releasebuffer ();
int nsummand = _wtoi(Cssummand);//atoi (Cssummand.getbuffer (0));
Cssummand.releasebuffer ();
int nret = Nplus + Nsummand; Perform addition operations

wchar_t chret[10] = {0};//char chret[128] = {0};
_itow_s (Nret, Chret, ten);//itoa (Nret, Chret, 10); Convert the result to a string
M_result.setwindowtext (Chret);
Todo:add your control notification handler code here
Cdialogex::onok ();
}

Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

Visual C + + Learning Note 1: Be sure to note the ANSI and Unicode differences

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.