Displays an exception occurs when starting,
Pray god help to see where the wrong
BOOL UTF8ToShiftJIS (const char * SRC, char * dest)
{
//utf-8 か ら Unicode に variations in し た occasions の long さ を o め る,
Int iWideLength=: : MultiByteToWideChar (CP_UTF8, 0, SRC, strlen (SRC), NULL, 0).
If (iWideLength==0) return FALSE.
LPWSTR lpWideString=new WCHAR [iWideLength];
Int iLength=0;
If (//utf-8 か ら Unicode に variations in す る,
(: : MultiByteToWideChar (CP_UTF8, 0, SRC, strlen (SRC), lpWideString, iWideLength)==0)
//Unicode か ら set Shift_JIS に variations in し た occasions の long さ を o め る,
| | ((iLength=: : WideCharToMultiByte (CP_ACP, 0, lpWideString iWideLength, NULL, 0, NULL, NULL))==0)
//Unicode か ら set Shift_JIS に variations in す る,
| | (: : WideCharToMultiByte (CP_ACP, 0, lpWideString iWideLength, dest, iLength, NULL, NULL)==0)) {
//variations in に failure
The delete lpWideString;
return FALSE;
}
//variations in に success
The delete lpWideString;
Return TRUE;
}
CodePudding user response:
PWSTR lpWideString=new WCHAR [iWideLength]; Many new one character is? 1, you can debug it