User guide

3.3. GLOBAL FUNCTIONS 79
Item Substitution
%s Write the next argument as a string using writes.
%tn Write t h e next argument as a left justified string in a field width of
n characters using writet.
%c Write the next argument as a character using wrch.
%# Write the next argument as an extended in UTF-8 or GB2312 for-
mat using codewrch.
%bn Write the next argument as a binary number in a field width of n
characters using writebin.
%on Write the next argument as an octal number in a field width of n
characters using writeoct.
%xn Write the next argument as a hexadecimal number in a field width
of n charact er s using writehex.
%in Write the next argument as a decimal number in a field width of n
characters using writed.
%n Write the next argument as a decimal number in its n at ural field
width using writen.
%un Write the next ar gu m e nt as an unsigned decimal number in a field
width of n characters using writeu.
%n.md Writ e the next argument as a scaled decimal number in a fi el d with
of n with m digits after the d eci m al point.
%+ Skip over the next argument.
%- Step back to the previous argument.
%% Write the ch ar a ct er %.
%pc Plural formation. Write character c if the next argument is not 1.
%p\a\b\ Plural formation. Write text a if the next argument is 1, otherwise
write text b.
%f Take the next argument as a writef format string and call writef
recursively to process it passing it the remaining arguments. The
argument pointer is advanced by the appropr ia t e amount
%m The next arument is taken as a message number and processes
as for %f above using the message format string obtained by the
call get
text(messno, str, upb) where str is a vector local to
writef to hold t he message string. This provides an easy way
to generate messages in different languages. get
text is a global
function typically defined by the user. The default version always
yields the message string "<mess:%-%n>"
Figure 3.6: writef substitution items