Microchip Technology SW006021-1N 사용자 설명서
![Microchip Technology](https://files.manualsbrain.com/attachments/cf42c3c895ef469f06d2e47e97fd98d738fcf5cf/common/fit/150/50/7340124dc8aa983aaf764094e2f06faab86f306c03111c5817f7e4e53fb2/brand_logo.gif)
Library Functions
2012 Microchip Technology Inc.
DS52053B-page 323
Example
#include <stdlib.h>
#include <stdio.h>
void
main (void)
{
char buf[80];
int i;
gets(buf);
i = atoi(buf);
printf(“Read %s: converted to %d\n”, buf, i);
}
See Also
xtoi()
, atof(), atol()
Return Value
A signed integer. If no number is found in the string, 0 will be returned.
ATOL
Synopsis
#include <stdlib.h>
long atol (const char * s)
Description
The
atol()
function scans the character string passed to it, skipping leading blanks. It
then converts an ASCII representation of a decimal number to a long integer.
Example
#include <stdlib.h>
#include <stdio.h>
void
main (void)
{
char buf[80];
long i;
gets(buf);
i = atol(buf);
printf(“Read %s: converted to %ld\n”, buf, i);
}
See Also
atoi()
, atof()
Return Value
A long integer. If no number is found in the string, 0 will be returned.