<< Previous | Next >> | |
|
NEAR SYNTAX: long _n_strtol( char * sptr, char ** tailptr, int base );
FAR SYNTAX: long _f_strtol( char far *sptr, char far * far * tailptr, int base );
NOTE By default, strtol()
is defined to_n_strtol()
.Description
- ANSI string to long 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
- sptr
- String to convert.
- tailptr
- Assigned the last position of the conversion. The next conversion may resume at the location specified by
*tailptr
.
- base
- Indicates the radix of conversion.
Return value
- The long integer.
Library
- STRING.LIB
See also
- atoi, atol
Dynamic C Functions | << Previous | Next >> | rabbit.com |