Unlike C
's printf()
, the arguments to fmt
are
automatically cast to the required type if possible. Thus, a
floating-point number can be printed as a hexadecimal integer with
"%X
", or a date field URL-escaped with "%U
". Any
cast that is nonsensical or impossible (like a varbyte
field to
"%t
" time) will print a "?
".
In version 3.01.984500000 20010313 and later, integer formats
are automatically cast to the largest integer type available to
avoid truncation, so the l
, ll
or w
flags are
not generally needed. This behavior can be controlled with the
promoteints
argument to fmtcp
(here).
CAVEATS
Many typecasts are possible but result in truncated output;
e.g. printing a float as an int will truncate any decimal places off.