chickadee » extras » printf

fprintf PORT FORMATSTRING #!optional ARG...procedure
printf FORMATSTRING #!optional ARG...procedure
sprintf FORMATSTRING #!optional ARG...procedure

Simple formatted output to a given port (fprintf), the value of (current-output-port) (printf), or a string (sprintf). The FORMATSTRING can contain any sequence of characters. There must be at least as many ARG arguments given as there are format directives that require an argument in FORMATSTRING. Extra ARG arguments are ignored. The character `~' prefixes special formatting directives:

~% write newline character
~N the same as ~%
~S write the next argument
~A display the next argument
~\n skip all whitespace in the format-string until the next non-whitespace character
~B write the next argument as a binary number
~O write the next argument as an octal number
~X write the next argument as a hexadecimal number
~C write the next argument as a character
~~ display `~'
~! flush all pending output
~? invoke formatted output routine recursively with the next two arguments as format-string and list of parameters