'2008/08'에 해당되는 글 1건
- 2008/08/20 char* to wchar_t*(LPWSTR)
LPWSTR ConvertLPCSTRToLPWSTR (char* pCstring)
{
LPWSTR pszOut = NULL;
{
LPWSTR pszOut = NULL;
if (pCstring != NULL)
{
int nInputStrLen = strlen (pCstring);
// Double NULL Termination
int nOutputStrLen = MultiByteToWideChar(CP_ACP, 0, pCstring, nInputStrLen, NULL, 0) + 2;
pszOut = new WCHAR [nOutputStrLen];
if (pszOut)
{
memset (pszOut, 0x00, sizeof (WCHAR)*nOutputStrLen);
MultiByteToWideChar (CP_ACP, 0, pCstring, nInputStrLen, pszOut, nInputStrLen);
}
}
return pszOut;
}
[사용]
char * str = new char[strlen("ASHOK") + 1];
strcpy(str, "ASHOK");
WCHAR * pwStr = ConvertLPCSTRToLPWSTR(str);

이올린에 북마크하기
Prev
Rss Feed