Download RH850 Coding - Renesas Electronics

Transcript
CubeSuite+ V2.01.00
CHAPTER 6 FUNCTIONAL SPECIFICATIONS
(b) If the string subject to conversion has an expected format and if the value of base is 0, the base number is judged from the input character string. The character string led by 0x is regarded as a hexadecimal value, and the character string to which 0 is prefixed but x is not is regarded as an octal number.
All the other character strings are regarded as decimal numbers.
(c) If the value of base is 2 to 36, it is used as the base number for conversion as mentioned above.
(d) If the string subject to conversion starts with a - sign, the sign of the value resulting from conversion
is reversed.
(3) The pointer that indicates the first character string
(a) This is stored in the object indicated by ptr, if ptr is not a null pointer.
(b) If the string subject conversion is vacant, or if it does not have an expected format, conversion is not
executed. The value of str is stored in the object indicated by ptr if ptr is not a null pointer.
Remark
This function is not re-entrant
[Example]
#include
<stdlib.h>
void func(long ret) {
char
*p;
ret = strtol("10", &p, 0);
/*10 is returned to ret.*/
ret = strtol("0x10", &p, 0);
/*16 is returned to ret.*/
ret = strtol("10x", &p, 2);
/*2 is returned to ret, and pointer to "x" is
returned to area of p.*/
ret = strtol("2ax3", &p, 16);
/*42 is returned to ret, and pointer to "x" is
returned to area of p.*/
:
}
R20UT2584EJ0101 Rev.1.01
Sep 01, 2013
Page 597 of 751