這是一個簡單的版本只是為了問,我有這個程式
wchar_t c;
wprintf(L"input\n");
wscanf(L"%d", &c);
wprintf(L"output\n");
wprintf(L"%lc", towlower(c));
和這個輸入/輸出

如果我輸入“W”,則輸出“?”,其他字符我也有同樣的情況。
uj5u.com熱心網友回復:
在該行中,您作為格式說明符wscanf(L"%d", &c);傳遞。%d搜索整數也是如此wscanf(),但您傳遞的是一個字符。更改為%c將解決它。
請參閱手冊頁中的規范wscanf(3):
d Matches an optionally signed decimal integer, whose format is the same
as expected for the subject sequence of wcstol() with the value 10 for
the base argument. In the absence of a size modifier, the application
shall ensure that the corresponding argument is a pointer to int.
...
c Matches a sequence of wide characters of exactly the number specified
by the field width (1 if no field width is present in the conversion
specification).
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/441813.html
標籤:C
