Convert a character string to a numeric value.
Compatibility:This function is compatible with the following targets:
|
|
#include <stdlib.h>
double atof(const char *nptr);Parameters:
Parameters for this facility are:
This function skips leading white space characters.
Return:
atof() returns a floating point value of type double.
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
int i;
long int j;
float f;
static char si[] = "-493", sli[] = "63870";
static char sf[] = "1823.4034";
f = atof(sf);
i = atoi(si);
j = atol(sli);
printf("%f %d %ld\n", f, i, j);
return 0;
}
Output:
1823.403400 -493 63870
[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.
Last updated: August 16, 2000