How multibyte string is converted to wide-character string in fxprintf.c in glibc?
问题 Currently, the logic in glibc source of perror is such: If stderr is oriented, use it as is, else dup() it and use perror() on dup() 'ed fd . If stderr is wide-oriented, the following logic from stdio-common/fxprintf.c is used: size_t len = strlen (fmt) + 1; wchar_t wfmt[len]; for (size_t i = 0; i < len; ++i) { assert (isascii (fmt[i])); wfmt[i] = fmt[i]; } res = __vfwprintf (fp, wfmt, ap); The format string is converted to wide-character form by the following code, which I do not understand: