Home > Software engineering >  Questions about UNICODE and MULTICHAR macros
Questions about UNICODE and MULTICHAR macros

Time:09-20

When programming in MFC, I default character set development, so the corresponding is char * if switch to UNICODE, with wchat_t, can also use Microsoft's macro LPCTSTR LPTSTR, cstrings adaptive, etc. But if we use a certain I like sprintf, what macros are automatically switching sprintf and wsprintf?

CodePudding user response:

Select the sprintf F1 in the MSDN documentation description
TCHAR. H Routine _UNICODE & amp; _MBCS Not Defined _MBCS Defined _UNICODE Defined
_stprintf sprintf sprintf swprintf

CodePudding user response:

refer to the original poster weixin_38305120 response:
when programming in MFC, I default character set development, so the corresponding is char * if switch to UNICODE, with wchat_t, can also use Microsoft's macro LPCTSTR LPTSTR, cstrings adaptive, etc. But if we use a certain I like sprintf, what macros are automatically switching sprintf and wsprintf?


The ancient Msdn6.0 unicode and multibyte versions of these functions and generic versions have instructions,

CodePudding user response:

 
# ifdef _UNICODE
Typedef would char_t;
Typedef STD: : wstring string_t;
Typedef STD: : wstringstream stringstream_t;
# the else
Typedef char char_t;
Typedef STD: : string string_t;
Typedef STD: : stringstream stringstream_t;
# endif

  • Related