.\" -*- coding: UTF-8 -*- '\" t .\" Copyright (c) Bruno Haible .\" .\" SPDX-License-Identifier: GPL-2.0-or-later .\" .\" References consulted: .\" GNU glibc-2 source code and manual .\" Dinkumware C library reference http://www.dinkumware.com/ .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html .\" ISO/IEC 9899:1999 .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH wprintf 3 "15 июня 2024 г." "Справочные страницы Linux 6.9.1" .SH НАИМЕНОВАНИЕ wprintf, fwprintf, swprintf, vwprintf, vfwprintf, vswprintf \- форматированный вывод широких символов .SH БИБЛИОТЕКА Стандартная библиотека языка C (\fIlibc\fP, \fI\-lc\fP) .SH ОБЗОР .nf \fB#include \fP \fB#include \fP .P \fBint wprintf(const wchar_t *restrict \fP\fIformat\fP\fB, ...);\fP \fBint fwprintf(FILE *restrict \fP\fIstream\fP\fB,\fP \fB const wchar_t *restrict \fP\fIformat\fP\fB, ...);\fP \fBint swprintf(wchar_t \fP\fIwcs\fP\fB[restrict .\fP\fImaxlen\fP\fB], size_t \fP\fImaxlen\fP\fB,\fP \fB const wchar_t *restrict \fP\fIformat\fP\fB, ...);\fP .P \fBint vwprintf(const wchar_t *restrict \fP\fIformat\fP\fB, va_list \fP\fIargs\fP\fB);\fP \fBint vfwprintf(FILE *restrict \fP\fIstream\fP\fB,\fP \fB const wchar_t *restrict \fP\fIformat\fP\fB, va_list \fP\fIargs\fP\fB);\fP \fBint vswprintf(wchar_t \fP\fIwcs\fP\fB[restrict .\fP\fImaxlen\fP\fB], size_t \fP\fImaxlen\fP\fB,\fP \fB const wchar_t *restrict \fP\fIformat\fP\fB, va_list \fP\fIargs\fP\fB);\fP .fi .P .RS -4 Требования макроса тестирования свойств для glibc (см. \fBfeature_test_macros\fP(7)): .RE .P .\" .BR wprintf (), .\" .BR fwprintf (), .\" .BR swprintf (), .\" .BR vwprintf (), .\" .BR vfwprintf (), .\" .BR vswprintf (): Все функции, показанные выше: .nf _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L .fi .SH ОПИСАНИЕ Семейство функций \fBwprintf\fP() является эквивалентом семейства \fBprintf\fP(3) для работы с широкими символами. Функции из этого семейства производят форматированный вывод широких символов. .P Функции \fBwprintf\fP() и \fBvwprintf\fP() выводят широкие символы в поток \fIstdout\fP. \fIstdout\fP должен быть открыт не для байтовых операций; подробности смотрите в \fBfwide\fP(3). .P Функции \fBwprintf\fP() и \fBvwprintf\fP() выводят широкие символы в поток \fIstream\fP. \fIstream\fP должен быть открыт не для байтовых операций; подробности смотрите в \fBfwide\fP(3). .P Функции \fBswprintf\fP() и \fBvswprintf\fP() выводят широкие символы в массив широких символов. Программист должен быть уверен, что в \fIwcs\fP достаточно места для \fImaxlen\fP широких символов. .P Все эти функции очень похожи на \fBprintf\fP(3), \fBvprintf\fP(3), \fBfprintf\fP(3), \fBvfprintf\fP(3), \fBsprintf\fP(3), \fBvsprintf\fP(3), но отличаются от них в следующем: .TP \fB\[bu]\fP Строка \fIformat\fP представляет собой строку широких символов. .TP \fB\[bu]\fP Вывод представляет собой широкие символы, а не байты. .TP \fB\[bu]\fP Функции \fBswprintf\fP() и \fBvswprintf\fP() имеют аргумент \fImaxlen\fP, а \fBsprintf\fP(3) и \fBvsprintf\fP(3) нет (функции \fBsnprintf\fP(3) и \fBvsnprintf\fP(3) имеют аргумент \fImaxlen\fP, но они не возвращают \-1 при переполнении буфера в Linux). .P Правила преобразования символов \fBc\fP и \fBs\fP различны: .TP \fBc\fP Если модификатора \fBl\fP нет, то аргумент \fIint\fP преобразуется в широкий символ с помощью вызова функции \fBbtowc\fP(3); затем полученный широкий символ записывается. Если модификатор \fBl\fP присутствует, то записывается аргумент (широкий символ) \fIwint_t\fP. .TP \fBs\fP If no \fBl\fP modifier is present: the \fIconst\ char\ *\fP 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 \fBmbrtowc\fP(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\[aq]\[rs]0\[aq]). If a precision is specified, no more wide characters than the number specified are written. Note that the precision determines the number of \fIwide characters\fP written, not the number of \fIbytes\fP or \fIscreen positions\fP. The array must contain a terminating null byte (\[aq]\[rs]0\[aq]), 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 \fBl\fP modifier is present: the \fIconst\ wchar_t\ *\fP 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. .SH "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ" Функции возвращают количество записанных широких символов, кроме завершающего нулевого символа для функций \fBswprintf\fP() и \fBvswprintf\fP(). В случае ошибки возвращается \-1. .SH АТРИБУТЫ Описание терминов данного раздела смотрите в \fBattributes\fP(7). .TS allbox; lbx lb lb l l l. Интерфейс Атрибут Значение T{ .na .nh \fBwprintf\fP(), \fBfwprintf\fP(), \fBswprintf\fP(), \fBvwprintf\fP(), \fBvfwprintf\fP(), \fBvswprintf\fP() T} Безвредность в нитях MT\-Safe locale .TE .SH СТАНДАРТЫ C11, POSIX.1\-2008. .SH ИСТОРИЯ POSIX.1\-2001, C99. .SH ПРИМЕЧАНИЯ Поведение \fBwprintf\fP() зависит от категории \fBLC_CTYPE\fP текущей локали. .P If the \fIformat\fP string contains non\-ASCII wide characters, the program will work correctly only if the \fBLC_CTYPE\fP category of the current locale at run time is the same as the \fBLC_CTYPE\fP category of the current locale at compile time. This is because the \fIwchar_t\fP 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 \[rs]unnnn does not solve this problem.) Therefore, in internationalized programs, the \fIformat\fP string should consist of ASCII wide characters only, or should be constructed at run time in an internationalized way (e.g., using \fBgettext\fP(3) or \fBiconv\fP(3), followed by \fBmbstowcs\fP(3)). .SH "СМОТРИТЕ ТАКЖЕ" \fBfprintf\fP(3), \fBfputwc\fP(3), \fBfwide\fP(3), \fBprintf\fP(3), \fBsnprintf\fP(3) .\" .BR wscanf (3) .PP .SH ПЕРЕВОД Русский перевод этой страницы руководства разработал(и) Azamat Hackimov , Yuri Kozlov и Kirill Rekhov . .PP Этот перевод является свободной программной документацией; он распространяется на условиях общедоступной лицензии GNU (GNU General Public License - GPL, .UR https://www.gnu.org/licenses/gpl-3.0.html .UE версии 3 или более поздней) в отношении авторского права, но БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ. .PP Если вы обнаружите какие-либо ошибки в переводе этой страницы руководства, пожалуйста, сообщите об этом разработчику(ам) по его(их) адресу(ам) электронной почты или по адресу .MT списка рассылки русских переводчиков .ME .