Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 ユーザーズマニュアル
製品コード
SW006021-1
MPLAB
®
XC8 C Compiler User’s Guide
DS52053B-page 376
2012 Microchip Technology Inc.
Example
#include <stdio.h>
#include <stdarg.h>
void
pf (int a, ...)
{
va_list ap;
va_start(ap, a);
while(a--)
puts(va_arg(ap, char *));
va_end(ap);
}
void
main (void)
{
pf(3, "Line 1", "Line 2", "Line 3");
}
XTOI
Synopsis
#include <stdlib.h>
unsigned xtoi (const char * s)
Description
The
xtoi()
function scans the character string passed to it, skipping leading blanks
reading an optional sign, and converts an ASCII representation of a hexadecimal
number to an integer.
number to an integer.
Example
#include <stdlib.h>
#include <stdio.h>
void
main (void)
{
char buf[80];
int i;
gets(buf);
i = xtoi(buf);
printf("Read %s: converted to %x\n", buf, i);
}
See Also
atoi()
Return Value
An unsigned integer. If no number is found in the string, zero will be returned.