changeset 603:e9578f62b346

All refentries finished.
author roug
date Fri, 15 Nov 2002 21:49:51 +0000
parents 42b2c775f05f
children 1d37d3a84a7c
files docs/ccguide/printf.refentry
diffstat 1 files changed, 151 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/docs/ccguide/printf.refentry	Fri Nov 15 21:49:51 2002 +0000
+++ b/docs/ccguide/printf.refentry	Fri Nov 15 21:49:51 2002 +0000
@@ -1,9 +1,9 @@
 <refentry id="printf">
 
 <refnamediv>
-<refname>printf</refname>
-<refname>fprintf</refname>
-<refname>sprintf</refname>
+<refname>Printf</refname>
+<refname>Fprintf</refname>
+<refname>Sprintf</refname>
 <refpurpose>formatted output</refpurpose>
 </refnamediv>
 
@@ -47,6 +47,154 @@
 "string". NOTE that it is the user's responsibility to ensure
 that this buffer is large enough.
 </para>
+<para>
+The "control" string determines the format, type, and number
+of the following arguments expected by the function. If the
+control does not match the arguments correctly, the results
+are unpredictable.
+</para>
+<para>
+The control may contain characters to be copied directly to
+the output and/or format specifications. Each format
+specification causes the function to take the next successive
+argument for output.
+</para>
+<para>
+A format specification consists of a "%" character followed by
+(in this order):
+</para>
+
+<itemizedlist spacing="compact">
+<listitem>
+<para>
+An optional minus sign ("-") that means left justification
+in the field.
+</para>
+</listitem>
+<listitem>
+<para>
+An optional string of digits indication the field width
+required. The field will be at least this wide and may be
+wider if the conversion requires it. The field will be
+padded on the left unless the above minus sign is present,
+in which case it will be padded on the right. The padding
+character is, by default, a space, but if the digit string
+starts with a zero ("0"), it will be "0".
+</para>
+</listitem>
+<listitem>
+<para>
+An optional dot (".") and a digit string, the precision,
+which for floating point arguments indicates the number
+of digits to follow the decimal point on conversion, and
+for strings, the maximum number of characters from the
+string argument are to be printed.
+</para>
+</listitem>
+<listitem>
+<para>
+An optional character "l" indicates that the following
+"d","x", or "o" is the specification of a long integer
+argument. NOTE that in order for the printing of long
+integers to take place, the source code must have in it
+somewhere the statement pflinit(), which causes routines
+to be linked from the library.
+</para>
+</listitem>
+<listitem>
+<para>
+A conversion character which shows the type of the
+argument and the desired conversion. The recognized
+conversion characters are:
+</para>
+
+<informaltable frame="none">
+<tgroup cols="2">
+<colspec colwidth="0.5in">
+<colspec colwidth="3in">
+<tbody>
+<row>
+<entry>d,o,x,X</entry>
+<entry>The argument is an integer and the
+conversion is to decimal, octal, or
+hexadecimal, respectively. "X" prints hex
+and alpha in upper case.</entry>
+</row>
+<row>
+<entry>u</entry>
+<entry>The argument is an integer and the
+conversion is to an unsigned decimal in
+the range 0 to 65535.</entry>
+</row>
+<row>
+<entry>f</entry>
+<entry>The argument is a double, and the form of
+the conversion is "[-]nnn.nnn". Where the
+digits after the decimal point are
+specified as above. If not specified, the
+precision defaults to six digits. If the
+precision is 0, no decimal point or
+following digits are printed.</entry>
+</row>
+<row>
+<entry>e,E</entry>
+<entry>The argument is a double and the form of
+the conversion is "[-]n.nnne(+or-)nn"; one
+digit before the decimal point, and the
+precision controls the number following.
+"E" prints the "e" in upper case.</entry>
+</row>
+<row>
+<entry>g,G</entry>
+<entry>The argument is a double, and either the
+"f" format or the "e" format is chosen,
+whichever is the shortest. If the "G"
+format is used, the "e" is printed in
+upper case.</entry>
+</row>
+</tbody>
+</tgroup>
+</informaltable>
+
+<para>
+NOTE in each of the above double conversions, the last digit is
+rounded.
+</para>
+<para>
+ALSO NOTE that in order for the printing of floats or doubles
+to take place, the source program <emphasis>must</emphasis> have the statement
+pffinit() somewhere.
+</para>
+
+<informaltable frame="none">
+<tgroup cols="2">
+<colspec colwidth="0.5in">
+<colspec colwidth="3in">
+<tbody>
+<row>
+<entry>c</entry>
+<entry>The argument as a character.</entry>
+</row>
+<row>
+<entry>s</entry>
+<entry>The argument is a pointer to a string.
+Characters from the string are printed up
+to a null character, or untill the number of
+characters indicated by the precision have
+been printed. If the precision is 0 or
+missing, the characters are not counted.</entry>
+</row>
+<row>
+<entry>%</entry>
+<entry>No argument corresponding; "%" is printed.</entry>
+</row>
+</tbody>
+</tgroup>
+</informaltable>
+
+</listitem>
+</itemizedlist>
+
 </refsect1>
 
 <refsect1><title>See Also</title>