User manual

Table Of Contents
mikroC PRO for PIC32
MikroElektronika
649
Sprint Library
The mikroC PRO for PIC32 provides the standard ANSI C Sprintf function for easy data formatting.
Note: In addition to ANSI C standard, the Sprint Library also includes two limited versions of the sprintf function
(sprinti and sprintl)
These functions take less ROM and RAM and may be more convenient for use in some cases.
Library Dependency Tree
Functions
- sprintf
- sprintl
- sprinti
sprintf
Prototype
void sprintf(char *wh, const code char *f,...);
Returns The function returns the number of characters actually written to destination string.
Description sprintf is used to format data and print them into destination string.
Parameters:
- wh: destination string
- f: format string
The f argument is a format string and may be composed of characters, escape sequences, and
format specications. Ordinary characters and escape sequences are copied to the destination string
in the order in which they are interpreted. Format specications always begin with a percent sign (%)
and require additional arguments to be included in the function call.
The format string is read from left to right. The rst format specication encountered refers to the
rst argument after f and then converts and outputs it using the format specication. The second
format specication accesses the second argument after f, and so on. If there are more arguments
than format specications, then these extra arguments are ignored. Results are unpredictable if there
are not enough arguments for the format specications. The format specications have the following
format:
% [ags] [width] [.precision] [{ l | L }] conversion_type
Each eld in the format specication can be a single character or a number which species a particular
format option. The conversion_type eld is where a single character species that the argument is
interpreted as a character, string, number, or pointer, as shown in the following table: