Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 User Manual
Product codes
SW006021-1
MPLAB
®
XC8 C Compiler User’s Guide
DS52053B-page 322
2012 Microchip Technology Inc.
ATOF
Synopsis
#include <stdlib.h>
double atof (const char * s)
Description
The
atof()
function scans the character string passed to it, skipping leading blanks. It
then converts an ASCII representation of a number to a double. The number may be in
decimal, normal floating point or scientific notation.
decimal, normal floating point or scientific notation.
Example
#include <stdlib.h>
#include <stdio.h>
void
main (void)
{
char buf[80];
double i;
gets(buf);
i = atof(buf);
printf(“Read %s: converted to %f\n”, buf, i);
}
See Also
atoi()
, atol(), strtod()
Return Value
A double precision floating-point number. If no number is found in the string, 0.0 will be
returned.
returned.
ATOI
Synopsis
#include <stdlib.h>
int atoi (const char * s)
Description
The
atoi()
function scans the character string passed to it, skipping leading blanks
and reading an optional sign. It then converts an ASCII representation of a decimal
number to an integer.
number to an integer.