Name
strtod function — Converts a string to double
Synopsis
double strtod(const char* str, char** end)The strtod function
converts a character array to a floating-point number. The string
str is divided into three parts:
optional whitespace, the text of the floating-point value, and a
trailing part, which starts with the first character that cannot be
part of a floating-point number. The first part is skipped, and the
second part is converted to a floating-point value. If the second
part is empty, 0 is returned. If
end is not null, *end is assigned a pointer to the start of
the third part of str. If the
third part is empty, *end points
to the terminating null character.
If the result would cause overflow, positive or negative
HUGE_VAL is returned, and
errno is set to ERANGE. If the result causes underflow,
0 is returned, and errno is set to ERANGE.
See Also
atoi function, strtol function, strtoul function, wcstod in <cwchar>
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access