【GUI】wxWidgets(旧wxWindows) その4【サイザー】at TECH
【GUI】wxWidgets(旧wxWindows) その4【サイザー】 - 暇つぶし2ch715:デフォルトの名無しさん
09/11/04 01:47:45
WCHAR *SJIS2WCS(string sjis)
{
if(sjis == "") return NULL;
int wlen = MultiByteToWideChar(CP_ACP, 0, sjis.c_str(), -1, NULL, 0);
WCHAR *wbuf = new WCHAR[wlen + 1];
if(wbuf == NULL) return NULL;
*wbuf = L'\0';
if(MultiByteToWideChar(CP_ACP, 0, sjis.c_str(), -1, wbuf, wlen) <= 0){
delete [] wbuf;
return NULL;
}
return wbuf;
}
string WCS2SJIS(WCHAR *wbuf)
{
if(wbuf == NULL || wbuf[0] == L'\0') return "";
int slen = WideCharToMultiByte(CP_ACP, 0, wbuf, -1, NULL, 0, NULL, NULL);
char *sbuf = (char *)_malloca((slen + 1) * sizeof(char));
if(sbuf == NULL) return "";
*sbuf = '\0';
if(WideCharToMultiByte(CP_ACP, 0, wbuf, -1, sbuf, slen, NULL, NULL) <= 0) return "";
sbuf[slen] = '\0';
return sbuf;
}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch