wprintf(3) Library Functions Manual wprintf(3) NOME wprintf, fwprintf, swprintf, vwprintf, vfwprintf, vswprintf - conversao de saida formatada de caracteres largos BIBLIOTECA Biblioteca C Padrao (libc, -lc) SINOPSE #include #include int wprintf(const wchar_t *restrict format, ...); int fwprintf(FILE *restrict stream, const wchar_t *restrict format, ...); int swprintf(wchar_t wcs[restrict .maxlen], size_t maxlen, const wchar_t *restrict format, ...); int vwprintf(const wchar_t *restrict format, va_list args); int vfwprintf(FILE *restrict stream, const wchar_t *restrict format, va_list args); int vswprintf(wchar_t wcs[restrict .maxlen], size_t maxlen, const wchar_t *restrict format, va_list args); Requisitos de macro de teste de recursos para o glibc (consulte feature_test_macros(7)): Todas as funcoes mostradas acima: _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L DESCRICAO A familia de funcoes wprintf() e a equivalente para caracteres largos a familia de funcoes printf(3). Ela realiza a saida formatada de caracteres largos. As funcoes wprintf() e vwprintf() realizam saida de caracteres largos para stdout. stdout nao deve ser orientado a byte; veja fwide(3) para maiores informacoes. As funcoes fwprintf() e vfwprintf() realizam saida de caracteres largos para fluxo. fluxo nao deve ser orientado a byte; veja fwide(3) para maiores informacoes. As funcoes swprintf() e vswprintf() realizam saida de caracteres largos para um array de caracteres largos. O programador deve garantir que ha espaco suficiente para no minimo maxlen caracteres largos em wcs. Estas funcoes sao como as funcoes printf(3), vprintf(3), fprintf(3), vfprintf(3), sprintf(3), vsprintf(3) exceto pelas seguintes diferencas: o A formato e uma string de caracteres largos. o A saida consiste de caracteres largos, nao bytes. o swprintf() e vswprintf() recebem um argumento maxcomp, sprintf(3) e vsprintf(3) nao recebem. (snprintf(3) e vsnprintf(3) recebem um argumento maxcomp, mas estas funcoes nao retornam -1 quando ocorre um estouro de buffer no GNU/Linux.) O tratamento de caracteres de conversao c e s e diferente: c Se nenhum modificador l esta presente, o argumento int e convertido para um caractere largo por uma chamada a para a funcao btowc(3), e o caractere largo resultante e escrito. Se um modificador l esta presente, o argumento wint_t (caractere largo) e escrito. s If no l modifier is present: the const char * argument is expected to be a pointer to an array of character type (pointer to a string) containing a multibyte character sequence beginning in the initial shift state. Characters from the array are converted to wide characters (each by a call to the mbrtowc(3) function with a conversion state starting in the initial state before the first byte). The resulting wide characters are written up to (but not including) the terminating null wide character (L'\0'). If a precision is specified, no more wide characters than the number specified are written. Note that the precision determines the number of wide characters written, not the number of bytes or screen positions. The array must contain a terminating null byte ('\0'), unless a precision is given and it is so small that the number of converted wide characters reaches it before the end of the array is reached. If an l modifier is present: the const wchar_t * argument is expected to be a pointer to an array of wide characters. Wide characters from the array are written up to (but not including) a terminating null wide character. If a precision is specified, no more than the number specified are written. The array must contain a terminating null wide character, unless a precision is given and it is smaller than or equal to the number of wide characters in the array. VALOR DE RETORNO As funcoes retornam o numero de caracteres largos escritos, excluindo-se o caractere largo nulo de terminacao no caso das funcoes swprintf() e vswprintf(). Elas retornam -1 quando ocorre um erro. ATRIBUTOS Para uma explicacao dos termos usados nesta secao, consulte attributes(7). +-------------------------------------+---------------+----------------+ |Interface | Atributo | Valor | +-------------------------------------+---------------+----------------+ |wprintf(), fwprintf(), swprintf(), | Thread safety | MT-Safe locale | |vwprintf(), vfwprintf(), vswprintf() | | | +-------------------------------------+---------------+----------------+ PADROES C11, POSIX.1-2008. HISTORICO POSIX.1-2001, C99. NOTAS O comportamento de wprintf() etc. depende da categoria LC_CTYPE da localizacao atual. If the format string contains non-ASCII wide characters, the program will work correctly only if the LC_CTYPE category of the current locale at run time is the same as the LC_CTYPE category of the current locale at compile time. This is because the wchar_t representation is platform- and locale-dependent. (The glibc represents wide characters using their Unicode (ISO/IEC 10646) code point, but other platforms don't do this. Also, the use of C99 universal character names of the form \unnnn does not solve this problem.) Therefore, in internationalized programs, the format string should consist of ASCII wide characters only, or should be constructed at run time in an internationalized way (e.g., using gettext(3) or iconv(3), followed by mbstowcs(3)). VEJA TAMBEM fprintf(3), fputwc(3), fwide(3), printf(3), snprintf(3) TRADUCAO A traducao para portugues brasileiro desta pagina man foi criada por Felipe M Pereira , Ricardo C.O.Freitas e Rafael Fontenelle . Esta traducao e uma documentacao livre; leia a Licenca Publica Geral GNU Versao 3 ou posterior para as condicoes de direitos autorais. Nenhuma responsabilidade e aceita. Se voce encontrar algum erro na traducao desta pagina de manual, envie um e-mail para a lista de discussao de tradutores . Linux man-pages 6.06 31 outubro 2023 wprintf(3)