Should we not be using wchar_t strings in modern C?<p><pre><code> int main(int argc, char *argv[]) {
wchar_t buf[100];
wprintf(L"Hello, world!\ntype something>");
if (fgetws(buf, 100, stdin))
wprintf(L"You typed '%ls'\n", buf);
if (argv[1]) {
char *s = argv[1];
/* Convert char string to wchar_t string */
size_t len = mbsrtowcs(buf, &s, 99, NULL);
if (len != (size_t)-1) {
buf[len] = 0;
wprintf(L"argv[1] is '%ls'\n", buf);
}
return 0;
}
</code></pre>
It's a pain, but the advantage is access to iswalpha() and friends.