strtod
Valid for: CANoe DE • CANoe:lite DE • CANoe4SW DE • CANoe4SW:lite DEFunction Syntax
int strtod(char s[], double& result);// form 1int strtod(char s[], dword startIndex, double& result);// form 2
Description
Converts the string s to a floating point number. The string must have the format[whitespace][sign][digits][.digits][{d|D|e|E}[sign]digits].
- Whitespace: may consist of space and tab characters, which are ignored
- sign: is either plus (+) or minus (-)
- digits: are one or more decimal digits. If no digits appear before the radix character, at least one must appear after the radix character. The decimal digits can be followed by an exponent, which consists of an introductory letter (d, D, e, or E) and an optionally signed integer. If neither an exponent part nor a radix character appears, a radix character is assumed to follow the last digit in the string.
Parameters
- s: String to be converted.
- result: Contains the converted value after the call. The value is 0 if the string can’t be converted to a number. It is the largest possible positive/negative number in case of overflow.
- startIndex: Position in s where the conversion shall begin.
Return Values
- -2: If s is empty or startIndex is larger than strlen(s).
- -1: An overflow occurs.