qc.hlp (Table of Contents; Topic list)
strtod, strtol, strtoul, _strtold
 Summary Example                         Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
     The strtod, strtol, and strtoul functions convert a character
     string to a double-precision value, a long-integer value, or an
     unsigned long-integer value, respectively. The _strtold function
     converts a character string to a double-precision floating-point
     value.
 
     The input string is a sequence of characters that can be
     interpreted as a numerical value of the specified type. If the
     strtod function appears in a compact-, large-, or huge-model
     program, <nptr> can be a maximum of 100 characters in length.
 
     These functions stop reading the string at the first character
     that they cannot recognize as part of a number. This may be the
     null character (\0) at the end of the string. With strtol or
     strtoul, this terminating character can also be the first numeric
     character greater than or equal to <base>. If <endptr> is not the
     null character, it points to the character that stopped the scan.
 
     The strtod and _strtold functions expect <nptr> to point to a
     string with the following form:
 
          [whitespace] [sign] [digits] [.digits] [ { d | D | e | E }
          [sign] digits]
 
     The first character that does not fit this form stops the scan.
 
     The strtol function expects <nptr> to point to a string with the
     following form:
 
          [whitespace] [sign] [O] [ { x | X } ] [digits]
 
     The strtoul function expects <nptr> to point to a string having
     this form:
 
          [whitespace] [O] [ { x | X } ] [digits]
 
     If <base> is between 2 and 36, it is used as the base of the
     number.
 
     If <base> is 0, the initial characters of the string pointed to by
     <nptr> are used to determine the base. If the first character is 0
     and the second character is not 'x' or 'X', the string is
     interpreted as an octal integer. Otherwise, it is interpreted as
     a decimal number.
 
     If the first character is '0' and the second character is 'x' or
     'X', the string is interpreted as a hexadecimal integer.
 
     If the first character is '1' - '9', the string is interpreted as
     a decimal integer. The letters 'a' through 'z' (or 'A' through 'Z')
     are assigned the values 10 - 35. Only letters whose assigned values
     are less than <base> are permitted.
 
     The strtoul function allows a + (plus) or - (minus) sign prefix; a
     leading minus sign indicates that the return value is negated.
 
     Return Value
 
     The strtod function returns the value of the floating-point
     number, except when the representation would cause an overflow, in
     which case it returns +/- HUGE_VAL. The function returns 0 if no
     conversion can be performed or an underflow occurs.
 
     The strtol function returns the value represented in the string,
     except when the representation would cause an overflow, in which
     case it returns LONG_MAX or LONG_MIN. If no conversion can be
     performed, the function returns 0.
 
     The strtoul function returns the converted value, if any. If no
     conversion can be performed, the function returns 0. The function
     returns ULONG_MAX on overflow.
 
     The _strtold function returns the value of the floating-point
     number, except when the representation would cause an overflow, in
     which case it returns LHUGE_VAL. The function returns 0 if no
     conversion can be performed or an underflow occurs.
 
     In all four functions, errno is set to ERANGE if an overflow or
     underflow occurs.
                                    -♦-