Something went wrong. Try again.
Cider Isn't Darwin Emulation, Really
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656.\" Copyright (c) 1990, 1991, 1993.\" The Regents of the University of California. All rights reserved..\".\" This code is derived from software contributed to Berkeley by.\" Chris Torek and the American National Standards Committee X3,.\" on Information Processing Systems..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\" notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\" notice, this list of conditions and the following disclaimer in the.\" documentation and/or other materials provided with the distribution..\" 4. Neither the name of the University nor the names of its contributors.\" may be used to endorse or promote products derived from this software.\" without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\" @(#)printf.3 8.1 (Berkeley) 6/4/93.\" FreeBSD: src/lib/libc/stdio/printf.3,v 1.47 2002/09/06 11:23:55 tjr Exp.\" $FreeBSD: src/lib/libc/stdio/wprintf.3,v 1.6 2007/01/09 00:28:08 imp Exp $.\".Dd July 5, 2003.Dt WPRINTF 3.Os.Sh NAME.Nm fwprintf ,.Nm swprintf ,.Nm vfwprintf ,.Nm vswprintf ,.Nm vwprintf ,.Nm wprintf.Nd formatted wide character output conversion.Sh LIBRARY.Lb libc.Sh SYNOPSIS.In stdio.h.In wchar.h.Ft int.Fo fwprintf.Fa "FILE *restrict stream".Fa "const wchar_t *restrict format".Fa ....Fc.Ft int.Fo swprintf.Fa "wchar_t *restrict ws".Fa "size_t n".Fa "const wchar_t *restrict format".Fa ....Fc.Ft int.Fo wprintf.Fa "const wchar_t *restrict format".Fa ....Fc.In stdarg.h.In stdio.h.In wchar.h.Ft int.Fo vfwprintf.Fa "FILE *restrict stream".Fa "const wchar_t *restrict format".Fa "va_list arg".Fc.Ft int.Fo vswprintf.Fa "wchar_t *restrict ws".Fa "size_t n".Fa "const wchar_t *restrict format".Fa "va_list arg".Fc.Ft int.Fo vwprintf.Fa "const wchar_t *restrict format".Fa "va_list arg".Fc.Sh DESCRIPTIONThe.Fn wprintffamily of functions produces output according to a.Fa format ,as described below.The.Fn wprintfand.Fn vwprintffunctionswrite output to.Dv stdout ,the standard output stream;.Fn fwprintfand.Fn vfwprintfwrite output to the given output.Fa stream ;.Fn swprintfand.Fn vswprintfwrite to the wide character string.Fa ws ..PpExtended locale versions of these functions are documented in.Xr wprintf_l 3 .See.Xr xlocale 3for more information..PpThese functions write the output under the control of a.Fa formatstring that specifies how subsequent arguments(or arguments accessed via the variable-length argument facilities of.Xr stdarg 3 )are converted for output..PpThese functions return the number of characters printed(not including the trailing.Ql \e0 ,used to end output to strings)..PpThe.Fn swprintfand.Fn vswprintffunctions will fail if.Fa nor more wide characters were requested to be written,.PpThe format string is composed of zero or more directives:ordinarycharacters (not.Cm % ) ,which are copied unchanged to the output stream;and conversion specifications, each of which resultsin fetching zero or more subsequent arguments.Each conversion specification is introduced bythe.Cm %character.The arguments must correspond properly (after type promotion)with the conversion specifier.After the.Cm % ,the following appear in sequence:.Bl -bullet.ItAn optional field, consisting of a decimal digit string followed by a.Cm $ ,specifying the next argument to access.If this field is not provided, the argument following the lastargument accessed will be used.Arguments are numbered starting at.Cm 1 .If unaccessed arguments in the format string are interspersed with ones thatare accessed the results will be indeterminate..ItZero or more of the following flags:.Bl -tag -width ".So \ Sc (space)".It Sq Cm #The value should be converted to an.Dq alternate form .For.Cm c , d , i , n , p , s ,and.Cm uconversions, this option has no effect.For.Cm oconversions, the precision of the number is increased to force the firstcharacter of the output string to a zero (except if a zero value is printedwith an explicit precision of zero).For.Cm xand.Cm Xconversions, a non-zero result has the string.Ql 0x(or.Ql 0Xfor.Cm Xconversions) prepended to it.For.Cm a , A , e , E , f , F , g ,and.Cm Gconversions, the result will always contain a decimal point, even if nodigits follow it (normally, a decimal point appears in the results ofthose conversions only if a digit follows).For.Cm gand.Cm Gconversions, trailing zeros are not removed from the result as theywould otherwise be..It So Cm 0 Sc (zero)Zero padding.For all conversions except.Cm n ,the converted value is padded on the left with zeros rather than blanks.If a precision is given with a numeric conversion.Cm ( d , i , o , u , i , x ,and.Cm X ) ,the.Cm 0flag is ignored..It Sq Cm \-A negative field width flag;the converted value is to be left adjusted on the field boundary.Except for.Cm nconversions, the converted value is padded on the right with blanks,rather than on the left with blanks or zeros.A.Cm \-overrides a.Cm 0if both are given..It So "\ " Sc (space)A blank should be left before a positive numberproduced by a signed conversion.Cm ( a , A , d , e , E , f , F , g , G ,or.Cm i ) ..It Sq Cm +A sign must always be placed before anumber produced by a signed conversion.A.Cm +overrides a space if both are used..It Sq Cm 'Decimal conversions.Cm ( d , u ,or.Cm i )or the integral portion of a floating point conversion.Cm ( for.Cm F )should be grouped and separated by thousands usingthe non-monetary separator returned by.Xr localeconv 3 ..El.ItAn optional decimal digit string specifying a minimum field width.If the converted value has fewer characters than the field width, it willbe padded with spaces on the left (or right, if the left-adjustmentflag has been given) to fill outthe field width..ItAn optional precision, in the form of a period.Cm \&.followed by anoptional digit string.If the digit string is omitted, the precision is taken as zero.This gives the minimum number of digits to appear for.Cm d , i , o , u , x ,and.Cm Xconversions, the number of digits to appear after the decimal-point for.Cm a , A , e , E , f ,and.Cm Fconversions, the maximum number of significant digits for.Cm gand.Cm Gconversions, or the maximum number of characters to be printed from astring for.Cm sconversions..ItAn optional length modifier, that specifies the size of the argument.The following length modifiers are valid for the.Cm d , i , n , o , u , x ,or.Cm Xconversion:.Bl -column ".Cm q Em (deprecated)" ".Vt signed char" ".Vt unsigned long long" ".Vt long long *".It Sy Modifier Ta Cm d , i Ta Cm o , u , x , X Ta Cm n.It Cm hh Ta Vt "signed char" Ta Vt "unsigned char" Ta Vt "signed char *".It Cm h Ta Vt short Ta Vt "unsigned short" Ta Vt "short *".It Cm l No (ell) Ta Vt long Ta Vt "unsigned long" Ta Vt "long *".It Cm ll No (ell ell) Ta Vt "long long" Ta Vt "unsigned long long" Ta Vt "long long *".It Cm j Ta Vt intmax_t Ta Vt uintmax_t Ta Vt "intmax_t *".It Cm t Ta Vt ptrdiff_t Ta (see note) Ta Vt "ptrdiff_t *".It Cm z Ta (see note) Ta Vt size_t Ta (see note).It Cm q Em (deprecated) Ta Vt quad_t Ta Vt u_quad_t Ta Vt "quad_t *".El.PpNote:the.Cm tmodifier, when applied to a.Cm o , u , x ,or.Cm Xconversion, indicates that the argument is of an unsigned typeequivalent in size to a.Vt ptrdiff_t .The.Cm zmodifier, when applied to a.Cm dor.Cm iconversion, indicates that the argument is of a signed type equivalent insize to a.Vt size_t .Similarly, when applied to an.Cm nconversion, it indicates that the argument is a pointer to a signed typeequivalent in size to a.Vt size_t ..PpThe following length modifier is valid for the.Cm a , A , e , E , f , F , g ,or.Cm Gconversion:.Bl -column ".Sy Modifier" ".Cm a , A , e , E , f , F , g , G".It Sy Modifier Ta Cm a , A , e , E , f , F , g , G.It Cm L Ta Vt "long double".El.PpThe following length modifier is valid for the.Cm cor.Cm sconversion:.Bl -column ".Sy Modifier" ".Vt wint_t" ".Vt wchar_t *".It Sy Modifier Ta Cm c Ta Cm s.It Cm l No (ell) Ta Vt wint_t Ta Vt "wchar_t *".El.ItA character that specifies the type of conversion to be applied..El.PpA field width or precision, or both, may be indicated byan asterisk.Ql *or an asterisk followed by one or more decimal digits and a.Ql $instead of adigit string.In this case, an.Vt intargument supplies the field width or precision.A negative field width is treated as a left adjustment flag followed by apositive field width; a negative precision is treated as though it weremissing.If a single format directive mixes positional.Pq Li nn$and non-positional arguments, the results are undefined..PpThe conversion specifiers and their meanings are:.Bl -tag -width ".Cm diouxX".It Cm diouxXThe.Vt int(or appropriate variant) argument is converted to signed decimal.Cm ( dand.Cm i ) ,unsigned octal.Pq Cm o ,unsigned decimal.Pq Cm u ,or unsigned hexadecimal.Cm ( xand.Cm X )notation.The letters.Dq Li abcdefare used for.Cm xconversions; the letters.Dq Li ABCDEFare used for.Cm Xconversions.The precision, if any, gives the minimum number of digits that mustappear; if the converted value requires fewer digits, it is padded onthe left with zeros..It Cm DOUThe.Vt "long int"argument is converted to signed decimal, unsigned octal, or unsigneddecimal, as if the format had been.Cm ld , lo ,or.Cm lurespectively.These conversion characters are deprecated, and will eventually disappear..It Cm eEThe.Vt doubleargument is rounded and converted in the style.Sm off.Oo \- Oc Ar d Li \&. Ar ddd Li e \\*[Pm] Ar dd.Sm onwhere there is one digit before thedecimal-point characterand the number of digits after it is equal to the precision;if the precision is missing,it is taken as 6; if the precision iszero, no decimal-point character appears.An.Cm Econversion uses the letter.Ql E(rather than.Ql e )to introduce the exponent.The exponent always contains at least two digits; if the value is zero,the exponent is 00..PpFor.Cm a , A , e , E , f , F , g ,and.Cm Gconversions, positive and negative infinity are represented as.Li infand.Li -infrespectively when using the lowercase conversion character, and.Li INFand.Li -INFrespectively when using the uppercase conversion character.Similarly, NaN is represented as.Li nanwhen using the lowercase conversion, and.Li NANwhen using the uppercase conversion..It Cm fFThe.Vt doubleargument is rounded and converted to decimal notation in the style.Sm off.Oo \- Oc Ar ddd Li \&. Ar ddd ,.Sm onwhere the number of digits after the decimal-point characteris equal to the precision specification.If the precision is missing, it is taken as 6; if the precision isexplicitly zero, no decimal-point character appears.If a decimal point appears, at least one digit appears before it..It Cm gGThe.Vt doubleargument is converted in style.Cm for.Cm e(or.Cm For.Cm Efor.Cm Gconversions).The precision specifies the number of significant digits.If the precision is missing, 6 digits are given; if the precision is zero,it is treated as 1.Style.Cm eis used if the exponent from its conversion is less than \-4 or greater thanor equal to the precision.Trailing zeros are removed from the fractional part of the result; adecimal point appears only if it is followed by at least one digit..It Cm aAThe.Vt doubleargument is converted to hexadecimal notation in the style.Sm off.Oo \- Oc Li 0x Ar h Li \&. Ar hhhp Oo \\*[Pm] Oc Ar d ,.Sm onwhere the number of digits after the hexadecimal-point characteris equal to the precision specification.If the precision is missing, it is taken as enough to exactlyrepresent the floating-point number; if the precision isexplicitly zero, no hexadecimal-point character appears.This is an exact conversion of the mantissa+exponent internalfloating point representation; the.Sm off.Oo \- Oc Li 0x Ar h Li \&. Ar hhh.Sm onportion represents exactly the mantissa; only denormalizedmantissas have a zero value to the left of the hexadecimalpoint.The.Cm pis a literal character.Ql p ;the exponent is preceded by a positive or negative signand is represented in decimal, using only enough charactersto represent the exponent.The.Cm Aconversion uses the prefix.Dq Li 0X(rather than.Dq Li 0x ) ,the letters.Dq Li ABCDEF(rather than.Dq Li abcdef )to represent the hex digits, and the letter.Ql P(rather than.Ql p )to separate the mantissa and exponent..It Cm CTreated as.Cm cwith the.Cm l(ell) modifier..It Cm cThe.Vt intargument is converted to an.Vt "unsigned char" ,then to a.Vt wchar_tas if by.Xr btowc 3 ,and the resulting character is written..PpIf the.Cm l(ell) modifier is used, the.Vt wint_targument is converted to a.Vt wchar_tand written..It Cm STreated as.Cm swith the.Cm l(ell) modifier..It Cm sThe.Vt "char *"argument is expected to be a pointer to an array of character type (pointerto a string) containing a multibyte sequence.Characters from the array are converted to wide characters and written up to(but not including)a terminating.Dv NULcharacter;if a precision is specified, no more than the number specified arewritten.If a precision is given, no null characterneed be present; if the precision is not specified, or is greater thanthe size of the array, the array must contain a terminating.Dv NULcharacter..PpIf the.Cm l(ell) modifier is used, the.Vt "wchar_t *"argument is expected to be a pointer to an array of wide characters(pointer to a wide string).Each wide character in the stringis written.Wide characters from the array are written up to (but not including)a terminating wide.Dv NULcharacter;if a precision is specified, no more than the number specified arewritten (including shift sequences).If a precision is given, no null characterneed be present; if the precision is not specified, or is greater thanthe number of characters inthe string, the array must contain a terminating wide.Dv NULcharacter..It Cm pThe.Vt "void *"pointer argument is printed in hexadecimal (as if by.Ql %#xor.Ql %#lx ) ..It Cm nThe number of characters written so far is stored into theinteger indicated by the.Vt "int *"(or variant) pointer argument.No argument is converted..It Cm %A.Ql %is written.No argument is converted.The complete conversion specificationis.Ql %% ..El.PpThe decimal pointcharacter is defined in the program's locale (category.Dv LC_NUMERIC ) ..PpIn no case does a non-existent or small field width cause truncation ofa numeric field; if the result of a conversion is wider than the fieldwidth, thefield is expanded to contain the conversion result..Sh SECURITY CONSIDERATIONSRefer to.Xr printf 3 ..Sh SEE ALSO.Xr btowc 3 ,.Xr fputws 3 ,.Xr printf 3 ,.Xr putwc 3 ,.Xr setlocale 3 ,.Xr wcsrtombs 3 ,.Xr wprintf_l 3 ,.Xr wscanf 3.Sh STANDARDSSubject to the caveats noted in the.Sx BUGSsectionof.Xr printf 3 ,the.Fn wprintf ,.Fn fwprintf ,.Fn swprintf ,.Fn vwprintf ,.Fn vfwprintf ,and.Fn vswprintffunctionsconform to.St -isoC-99 .