986
Appendix A: System Routines — Strings
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
sprintf
Declaration:
int
sprintf
(char *
buf
, const char *
fmt_str
, . . . )
Category(ies):
Strings, Utilities
Description:
The
sprintf
function formats and prints a series of characters to
buf
. Each
argument (if any) is converted and stored according to the corresponding
format specification in
fmt_str
. A null-character ('\0') is appended at the end
of the characters written.
The following standard conversions are supported.
%d %i — Integer argument is converted to signed decimal notation.
%u — Integer argument is converted to unsigned decimal notation.
%o — Integer argument is converted to octal notation.
%b — Integer argument is converted to binary notation.
%x %X — Integer argument is converted to hex notation (lower/upper
case).
%p — Void * argument is converted to 0xhhhhhhhh form (same as
%#.8x).
Note:
The above conversions may be preceded by an ‘l’ to signify a long integer
argument.
%f — Double argument is converted to decimal notation of the form
[-]ddd.ddd (where ddd represents zero or more digits).
%e %E — Double argument is converted to decimal notation of the form
[-]d.ddde[+-]ddd.
%g %G — Double argument is converted according to the %f or the %e
format depending on the value converted.
%c — Integer argument is converted into an unsigned char.
%s — Char * argument is a pointer to string; string characters are
written up to null character or specified precision count.
%% — Literal ‘%’.
(continued)