<< Previous | Next >> | |
|
NEAR SYNTAX: float _n_strtod( char * s, char ** tailptr );
FAR SYNTAX: float _f_strtod( char far * s, char far * far * tailptr );
NOTE By default, strtod()
is defined to_n_strtod()
.Description
- ANSI string to float conversion.
- For Rabbit 4000+ users, this function supports FAR pointers. The macro
USE_FAR_STRING
will change all calls to functions in this library to their far versions by default. The user may also explicitly call the far version with_f_strfunc
, wherestrfunc
is the name of the string function.
- Because FAR addresses are larger, the far versions of this function will run slightly slower than the near version. To explicitly call the near version when the
USE_FAR_STRING
macro is defined and all pointers are near pointers, append_n_
to the function name, e.g._n_strtod
. For more information about FAR pointers, see th Dynamic C User's Manual or the samples inSamples/Rabbit4000/FAR/
.
- In the following examples:
[ ] = 1 byte
[ ][ ][x][x] indicates a NEAR address (16 bit) upcast to FAR
- Passing a "char far * far * ptr" as tailptr:
ADDRESS: DATA:
[ ][ ][x][x] [y][y][y][y] (tailptr)
[y][y][y][y] [z][z][z][z] (*tailptr)
[z][z][z][z] [Correct contents] (**tailptr)
- Passing a 'char ** ptr' as tailptr: Note the first pointer can be upcast to FAR but the compiler doesn't know to upcast the internal pointer.
ADDRESS: DATA:
[ ][ ][x][x] [ ][ ][y][y] (tailptr)
[ ][ ][y][y] [?][?][z][z] (*tailptr)
[?][?][z][z] [Incorrect contents] (**tailptr)Parameters
- s
- String to convert.
- tailptr
- Pointer to a pointer of character. The next conversion may resume at the location specified by
*tailptr
.
Return value
- The float number represented by "s."
Library
- STRING.LIB
See also
- atof
Dynamic C Functions | << Previous | Next >> | rabbit.com |