


      PPPPRRRRIIIINNNNTTTTFFFF((((3333SSSS))))                  ((((UUUUNNNNIIIIXXXX 5555....0000))))                 PPPPRRRRIIIINNNNTTTTFFFF((((3333SSSS))))



      NNNNAAAAMMMMEEEE
           printf, fprintf, sprintf - print formatted output

      SSSSYYYYNNNNTTTTAAAAXXXX
           ####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddiiiioooo....hhhh>>>>

           iiiinnnntttt pppprrrriiiinnnnttttffff ((((ffffoooorrrrmmmmaaaatttt [ ,,,, arg ] ...  ))))
           cccchhhhaaaarrrr ****ffffoooorrrrmmmmaaaatttt;;;;

           iiiinnnntttt ffffpppprrrriiiinnnnttttffff ((((ssssttttrrrreeeeaaaammmm,,,, ffffoooorrrrmmmmaaaatttt [ ,,,, arg ] ...  ))))
           FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm;;;;
           cccchhhhaaaarrrr ****ffffoooorrrrmmmmaaaatttt;;;;

           iiiinnnntttt sssspppprrrriiiinnnnttttffff ((((ssss,,,, ffffoooorrrrmmmmaaaatttt [ ,,,, arg ] ...  ))))
           cccchhhhaaaarrrr ****ssss,,,, ffffoooorrrrmmmmaaaatttt;;;;

      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
           _P_r_i_n_t_f places output on the standard output stream _s_t_d_o_u_t.
           _F_p_r_i_n_t_f places output on the named output _s_t_r_e_a_m.  _S_p_r_i_n_t_f
           places ``output'', followed by the null character (\\\\0000) in
           consecutive bytes starting at *_s; it is the user's
           responsibility to ensure that enough storage is available.
           Each function returns the number of characters transmitted
           (not including the \\\\0000 in the case of _s_p_r_i_n_t_f), or a negative
           value if an output error was encountered.

           Each of these functions converts, formats, and prints its
           _a_r_gs under control of the _f_o_r_m_a_t.  The _f_o_r_m_a_t is a character
           string that contains two types of objects:  plain
           characters, which are simply copied to the output stream,
           and conversion specifications, each of which results in
           fetching of zero or more _a_r_gs.  The results are undefined if
           there are insufficient _a_r_gs for the format.  If the format
           is exhausted while _a_r_gs remain, the excess _a_r_gs are simply
           ignored.

           Each conversion specification is introduced by the character
           %%%%.  After the %%%%, the following appear in sequence:

                Zero or more _f_l_a_g_s, which modify the meaning of the
                conversion specification.

                An optional decimal digit string specifying a minimum
                _f_i_e_l_d _w_i_d_t_h.  If the converted value has fewer
                characters than the field width, it will be padded on
                the left (or right, if the left-adjustment flag (see
                below) has been given) to the field width;

                A _p_r_e_c_i_s_i_o_n that gives the minimum number of digits to
                appear for the dddd, oooo, uuuu, xxxx, or XXXX conversions, the number
                of digits to appear after the decimal point for the eeee
                and ffff conversions, the maximum number of significant



      Page 1                                                   (9010-E)






      PPPPRRRRIIIINNNNTTTTFFFF((((3333SSSS))))                  ((((UUUUNNNNIIIIXXXX 5555....0000))))                 PPPPRRRRIIIINNNNTTTTFFFF((((3333SSSS))))



                digits for the gggg conversion, or the maximum number of
                characters to be printed from a string in ssss conversion.
                The precision takes the form of a period (....) followed
                by a decimal digit string:  a null digit string is
                treated as zero.

                An optional llll specifying that a following dddd, oooo, uuuu, xxxx,
                or XXXX conversion character applies to a long integer
                _a_r_g.

                A character that indicates the type of conversion to be
                applied.

           A field width or precision may be indicated by an asterisk
           (****) instead of a digit string.  In this case, an integer _a_r_g
           supplies the field width or precision.  The _a_r_g that is
           actually converted is not fetched until the conversion
           letter is seen, so the _a_r_gs specifying field width or
           precision must appear _b_e_f_o_r_e the _a_r_g (if any) to be
           converted.

           The flag characters and their meanings are:
           ----         The result of the conversion will be left-
                     justified within the field.
           ++++         The result of a signed conversion will always
                     begin with a sign (++++ or ----).
           blank     If the first character of a signed conversion is
                     not a sign, a blank will be prefixed to the
                     result.  This implies that if the blank and ++++
                     flags both appear, the blank flag will be ignored.
           ####         This flag specifies that the value is to be
                     converted to an ``alternate form.''For cccc, dddd, ssss,
                     and uuuu conversions, the flag has no effect.  For oooo
                     conversion, it increases the precision to force
                     the first digit of the result to be a zero.  For xxxx
                     (XXXX) conversion, a non-zero result will have 0000xxxx
                     (0000XXXX) prefixed to it.  For eeee, EEEE, ffff, gggg, and GGGG
                     conversions, the result will always contain a
                     decimal point, even if no digits follow the point
                     (normally, a decimal point appears in the result
                     of these conversions only if a digit follows it).
                     For gggg and GGGG conversions, trailing zeroes will _n_o_t
                     be removed from the result (which they normally
                     are).

           The conversion characters and their meanings are:

           dddd,oooo,uuuu,xxxx,XXXX The integer _a_r_g is converted to signed decimal,
                     unsigned octal, decimal, or hexadecimal notation
                     (xxxx and XXXX), respectively; the letters aaaabbbbccccddddeeeeffff are
                     used for xxxx conversion and the letters AAAABBBBCCCCDDDDEEEEFFFF for XXXX
                     conversion.  The precision specifies the minimum



      Page 2                                                   (9010-E)






      PPPPRRRRIIIINNNNTTTTFFFF((((3333SSSS))))                  ((((UUUUNNNNIIIIXXXX 5555....0000))))                 PPPPRRRRIIIINNNNTTTTFFFF((((3333SSSS))))



                     number of digits to appear; if the value being
                     converted can be represented in fewer digits, it
                     will be expanded with leading zeroes.  The default
                     precision is 1.  The result of converting a zero
                     value with a precision of zero is a null string.
           ffff         The float or double _a_r_g is converted to decimal
                     notation in the style ``[----]ddd....ddd'', where the
                     number of digits after the decimal point is equal
                     to the precision specification.  If the precision
                     is missing, 6 digits are output; if the precision
                     is explicitly 0, no decimal point appears.
           eeee,EEEE       The float or double _a_r_g is converted in the style
                     ``[----]d....dddeeee++++____dd'', where there is one digit before
                     the decimal point and the number of digits after
                     it is equal to the precision; when the precision
                     is missing, 6 digits are produced; if the
                     precision is zero, no decimal point appears.  The
                     EEEE format code will produce a number with EEEE instead
                     of eeee introducing the exponent.  The exponent
                     always contains at least two digits.
           gggg,GGGG       The float or double _a_r_g is printed in style ffff or eeee
                     (or in style EEEE in the case of a GGGG format code),
                     with the precision specifying the number of
                     significant digits.  The style used depends on the
                     value converted:  style eeee will be used only if the
                     exponent resulting from the conversion is less
                     than -4 or greater than the precision.  Trailing
                     zeroes are removed from the result; a decimal
                     point appears only if it is followed by a digit.
           cccc         The character _a_r_g is printed.
           ssss         The _a_r_g is taken to be a string (character
                     pointer) and characters from the string are
                     printed until a null character (\\\\0000) is encountered
                     or the number of characters indicated by the
                     precision specification is reached.  If the
                     precision is missing, it is taken to be infinite,
                     so all characters up to the first null character
                     are printed.  If the string pointer _a_r_g has the
                     value zero, the result is undefined.  A _n_u_l_l arg
                     will yield undefined results.
           %%%%         Print a %%%%; no argument is converted.

           In no case does a non-existent or small field width cause
           truncation of a field; if the result of a conversion is
           wider than the field width, the field is simply expanded to
           contain the conversion result.  Characters generated by
           _p_r_i_n_t_f and _f_p_r_i_n_t_f are printed as if _p_u_t_c(3S) had been
           called.

      EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
           To print a date and time in the form ``Sunday, July 3,
           10:02'', where _w_e_e_k_d_a_y and _m_o_n_t_h are pointers to null-



      Page 3                                                   (9010-E)






      PPPPRRRRIIIINNNNTTTTFFFF((((3333SSSS))))                  ((((UUUUNNNNIIIIXXXX 5555....0000))))                 PPPPRRRRIIIINNNNTTTTFFFF((((3333SSSS))))



           terminated strings:

                printf("%s, %s %d, %....2d::::%....2d", weekday, month, day, hour, min);

           To print _p_i to 5 decimal places:

                printf("pi = %....5f", 4*atan(1....0));

      SSSSEEEEEEEE AAAALLLLSSSSOOOO
           ecvt(3C), putc(3S), scanf(3S), stdio(3S).













































      Page 4                                                   (9010-E)



