/* wprintf example */ #include <wchar.h> int main() { wprintf (L"Characters: %lc %lc \n", L'a', 65); wprintf (L"Decimals: %d %ld\n", 1977, 650000L); wprintf (L"Preceding with blanks: %10d \n", 1977); wprintf (L"Preceding with zeros: %010d \n", 1977); wprintf (L"Some different radixes: %d %x %o %#x %#o \n", 100, 100, 100, 100, 100); wprintf (L"floats: %4.2f %+.0e %E \n", 3.1416, 3.1416, 3.1416); wprintf (L"Width trick: %*d \n", 5, 10); wprintf (L"%ls \n", L"A wide string"); return 0; } |
Characters: a A Decimals: 1977 650000 Preceding with blanks: 1977 Preceding with zeros: 0000001977 Some different radixes: 100 64 144 0x64 0144 floats: 3.14 +3e+000 3.141600E+000 Width trick: 10 A wide string |
fputws | 将宽字符串写入流(function ) |
wscanf | 从stdin读取格式化的数据(function ) |
fwprintf | 将格式化的数据写入流(function ) |