SW006013 Microchip Technology, SW006013 Datasheet - Page 93

MPLAB C Compiler For DsPIC DSCs

SW006013

Manufacturer Part Number
SW006013
Description
MPLAB C Compiler For DsPIC DSCs
Manufacturer
Microchip Technology
Series
DsPIC30F/33Fr
Type
MPLAB® C Compilerr
Datasheet

Specifications of SW006013

Supported Families
DsPIC30F, DsPIC33F
Core Architecture
DsPIC
Kit Contents
Software And Docs
Mcu Supported Families
DsPIC30F And DsPIC33F
Tool Function
Compiler
Tool Type
Compiler
Processor Series
dsPIC
Lead Free Status / RoHS Status
na
For Use With/related Products
dSPIC DSCs
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
© 2008 Microchip Technology Inc.
vsprintf
Description:
Include:
Prototype:
Arguments:
Return Value:
Remarks:
Example:
Prints formatted text to a string using a variable length argument list
<stdio.h>
<stdarg.h>
int vsprintf(char *s, const char *format, va_list
ap);
s
format
ap
Returns number of characters stored in s excluding the terminating null
character.
The format argument has the same syntax and use that it has in
printf.
To access the variable length argument list, the ap variable must be ini-
tialized by the macro va_start and may be reinitialized by additional
calls to va_arg. This must be done before the vsprintf function is
called. Invoke va_end after the function returns. For more details see
stdarg.h
#include <stdio.h>
#include <stdarg.h>
void errmsg(const char *fmt, ...)
{
}
int main(void)
{
}
Output:
Error: The letter 'a' is not an integer value.
Error: Requires 3 or more characters.
va_list ap;
char buf[100];
va_start(ap, fmt);
vsprintf(buf, fmt, ap);
va_end(ap);
printf("Error: %s", buf);
int num = 3;
errmsg("The letter '%c' is not %s\n", 'a',
errmsg("Requires %d%s\n", num,
"an integer value.");
" or more characters.\n");
storage string for output
format control string
pointer to a list of arguments
/* for vsprintf, printf */
/* for va_start,
/* va_list, va_end
DS51456E-page 89
*/
*/

Related parts for SW006013