Would the STR [20].
InputBox (STR, 10, L "please enter the number of words");
Set_num=_wtoi (STR);
Because my project many function under multiple character set to use, but this function can only be used under the UNICODE, could you tell me how to solve this error in a project,
CodePudding user response:
Or, how in a project with a piece of code undef UNICODE in the project after another use UNICODE code,CodePudding user response:
Or, how to write an input box, multiple character sets.CodePudding user response:
The two would be and char conversion function don't have to,STD: : wstring char2wchar (const char * c, size_t=CP_ACP m_encode/* */)
{
STD: : wstring STR.
Int len=: : MultiByteToWideChar (m_encode, 0, c, strlen (c), NULL, 0).
Would be * m_wchar=new would [len + 1];
: : MultiByteToWideChar (m_encode, 0, c, strlen (c), m_wchar, len);
M_wchar [len]='\ 0';
STR=m_wchar;
The delete m_wchar;
return str;
}
STD: : string wchar2char (const would * wp, size_t=CP_ACP m_encode/* */)
{
STD: : string STR.
Int len=: : WideCharToMultiByte (m_encode, 0, wp, wcslen (wp), NULL, 0, NULL, NULL);
Char * m_char=new char [len + 1];
: : WideCharToMultiByte (m_encode, 0, wp, wcslen (wp), m_char, len, NULL, NULL);
M_char [len]='\ 0';
STR=m_char;
The delete m_char;
return str;
}
The function USES to similar as follows:
Char * STR="please enter the number of words";
String s=char2wchar (STR);
Char str1 [20].
InputBox (str1, strlen (s) + 1, s.c _str);
CodePudding user response: