#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
int main (void)
{
char str1[1024] = "Hello, World";
wchar_t str2[1024];
void *inBuf, *outBuf;
int bufSize;
inBuf = (char *)&str1;
outBuf = (wchar_t*)&str2;
bufSize = strlen ((char *)inBuf);
mbstowcs (outBuf, inBuf, bufSize);
// wprintf (L"%S", outBuf);
memset (inBuf, 0x00, 1024);
bufSize = wcslen ((wchar_t *)outBuf);
wcstombs (inBuf, outBuf, bufSize);
printf ("%s\n", inBuf);
return 0;
}
in Linux
wprintf (L"%S", outBuf);
출력 후, 프로그램이 죽는다. 이유를 모르겠다. -_-;
in Win32
wprintf (L"%S", outBuf);
H 만 출력됨
iconv을 이용해서 ASCII를 UNICODE로 transcode를 했는데, 반대로는 안 된다......
--- 결과 ---
Hello, World
'Programming > C,C++' 카테고리의 다른 글
strstr 문자열 찾기 (0) | 2017.01.11 |
---|---|
Bubble Sort (0) | 2017.01.10 |
Unicode에 관련하여[펌] (0) | 2017.01.09 |
ansi2uni in Win32 (0) | 2017.01.07 |
Multithreading Applications in Win32 (0) | 2017.01.05 |