SW006014 Microchip Technology, SW006014 Datasheet - Page 87

C COMPILER MPLAB FOR PIC24 MCU

SW006014

Manufacturer Part Number
SW006014
Description
C COMPILER MPLAB FOR PIC24 MCU
Manufacturer
Microchip Technology
Type
MPLAB® C Compilerr
Series
PIC24r
Datasheet

Specifications of SW006014

Supported Families
PIC24
Core Architecture
PIC
Kit Contents
Software And Docs
Mcu Supported Families
PIC24
Tool Function
Compiler
Tool Type
Compiler
Processor Series
PIC24
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC24
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
© 2008 Microchip Technology Inc.
sprintf
Description:
Include:
Prototype:
Arguments:
Return Value:
Remarks:
Example:
sscanf
Description:
Include:
Prototype:
Arguments:
Return Value:
Remarks:
Prints formatted text to a string
<stdio.h>
int sprintf(char *s, const char *format, ...);
s
format
...
Returns the 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.
#include <stdio.h> /* for sprintf, printf */
int main(void)
{
}
Output:
Number of characters printed to string buffer = 25
String = Print this string 1 time
Scans formatted text from a string
<stdio.h>
int sscanf(const char *s, const char *format, ...);
s
format
...
Returns the number of items successfully converted and assigned. If
no items are assigned, a 0 is returned. EOF is returned if an input error
is encountered before the first conversion.
The format argument has the same syntax and use that it has in
scanf.
char sbuf[100], s[]="Print this string";
int x = 1, y;
char a = '\n';
y = sprintf(sbuf, "%s %d time%c", s, x, a);
printf("Number of characters printed to "
printf("String = %s\n", sbuf);
"string buffer = %d\n", y);
storage string for output
format control string
optional arguments
storage string for input
format control string
optional arguments
DS51456E-page 83

Related parts for SW006014