Owner said:
what's wrong with this code?
#include <locale.h>
#include <stdio.h>
#include <wchar.h>
main(){
Should be "int main(void) {", but that's not the problem.
setlocale(LC_CTYPE, "");
wchar_t a = L'한';
putwchar(a);
}
result
test.c:7: warning: multi-character character constant
It's hard to tell. Your article appears to have an euc-kr encoding
(judging by the "Content-Type:" header on your article), but
that could have been introduced by some news software somewhere.
Is your original source file encoded in euc-kr?
Probably your compiler doesn't recognize the character encoding you
used in your source file, and is interpreting the bytes between the
single quotes as two 8-bit characters, producing a multi-character
character constant.
Note that a call to setlocale() (which occurs at run time) cannot
affect the compiler's interpretation of source characters.
See what your compiler's documentation says about source character
sets. You might hae better luck using UTF-8.