FTNIRPS C-3


NAME



ftnirps - string formatter

SYNOPSIS



ftnirps (s, format [, arg ] ... )
char *s;
char *format;

DESCRIPTION



Ftnirps formats a string from the argument list and copies the
string to s with a terminating null character (\0). This function
is compatible with sprintf(C-3) except that not all of the
conversion specifications are implemented. Ftnirps is called
internally by C/Base instead of sprintf for code size
considerations. It lacks many of the fancy features of sprintf
and does not handle floating point at all. This makes ftnirps
much smaller and likewise programs that call ftnirps. It is
recommended that, if possible, sprintf(C-3) be called in place of
ftnirps.

Formatting and conversion is controlled by the format argument.
The format is a character string that contains either characters
to copy into the formatted string or conversion specifications.
Conversion specifications take additional arguments from the
list, convert them and copy the result in the formatted string.

The implemented conversions are:

%s takes the next argument as a pointer to a null terminated
string and copies the string to the formatted string

%d takes the next argument as an integer, converts the integer
to ascii, and copies the result into the formatted string

%ld takes the next argument is a long integer, converts the
integer to ascii, and copies the result into the formatted
string

%c takes the next argument as a single character and stores the
character in the formatted string

%% a percent sign (%) or any other character not listed above
immediately following a % is copied to the formatted string

Conversions %s, %d and %ld also understand field widths. A field
width is specified as a string of numeric digits immediately
following the % (before the conversion character). If the field
width begins with a -, the converted result is left justified
instead of the default right justification. For conversions %d
and %ld, if the field width digits begin with 0, zero fill is
done instead of the default blank fill.

SEE ALSO



sprintf(3S)

NOTES



Since ftnirps does not implement floating point conversions, to
print floating point values you must convert the values with
realtoa(C-3), moneytoa(C-3) or sprintf(C-3).

Sometimes things make more sense when spelled backwards.