VC Data types

Source: Internet
Author: User

string processing and mutual conversions under different coding formats:

The data types that people often encounter when programming:
Ansi:
Char, char *, const char *
CHAR, (PCHAR, PSTR, LPSTR), LPCSTR

Unicode:
wchar_t, wchar_t *, const wchar_t *
WCHAR, (Pwchar, Pwstr, LPWSTR), LPCWSTR

T generic type:
TCHAR, (TCHAR *, Ptchar, PTSTR, LPTSTR), LPCTSTR

Above, where: P represents the meaning of the pointer, str stands for the meaning of the string, L is the meaning of the long pointer, can be ignored under the WIN32 platform, C stands for the meaning of the const constant, W stands for the meaning of the wide wide byte, t everyone can understand the meaning of the universal type,
It is possible to define _UNICODE macros according to the project, respectively, to define different types, such as: TCHAR type, if _UNICODE macro is defined in the project, then he is ultimately defined as the wchar_t type,
If the _UNICODE macro is not defined in the project, then TCHAR is ultimately defined as a char type.

Its convenience is to modify the coding format of the project without modifying the code, so it is recommended that you use the common type when writing programs!

VC Data types

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.