Texas Instruments TMS34010 Reference Manual page 156

C compiler
Hide thumbs Also See for TMS34010:
Table of Contents

Advertisement

String to Number
strtod/strtol/strtoul
Syntax
#include
<stdlib.h>
double strtod(nptr, endptr)
char
*nptr;
char
**endptr;
long int strtol(nptr, endptr, base)
char
*nptr;
. char
* * endptr ;
int
base;
unsigned long int strtoul(nptr, endptr, base)
char
*nptr;
char
**endptr;
int
base;
Defined in
strtod. c in rts. src
strtol. c in rts. src
strtoul. c in rts. src
Description
Three functions convert ASCII strings to numeric values. For each function,
argument nptr points to the original string. Argument endptr points to a
pointer; the functions set this pointer to point to the first character after the
converted string. The functions that convert to integers also have a third
argument, base.
The strtod function converts a string to a floating-point value. The
string must have the following format:
[space] [sign] digits [.digits] [elE [sign] integer]
The function returns the converted string; if the original string is
empty or does not have the correct format, the function returns a O.
If the converted string would cause an overflow, the function returns
±HUGE-VAL; if the converted string woul.d cause an underflow, the
function returns O. If the converted string causes an overflow or an
underflow, errno is set to the value of ERANGE.
The strtol function converts a string to a long integer. The string
must have the following format:
[space] [sign] digits [.digits] [elE [sign] integer]
The strtoul function converts a string to a long integer. The string
must be specified in the following format:
[space] [sign] digits [.digits] [elE [sign] integer]
The
space
is indicated by a spacebar, horizontal or vertical tab, carriage re-
turn, form feed, or newline. Following the space is an optional
sign,
and
then
digits
that represent the integer portion of the number. The fractional
part of the number follows, then the exponent, including an optional
sign.
The first unrecognized character terminates the string.
The pointer that
endptr points to is set to point to this character.
6-81

Advertisement

Table of Contents
loading

Table of Contents