C++ 程式設計/程式碼/標準 C 庫/函式/strtod
外觀
| 語法 |
#include <cstdlib>
double strtod( const char *start, char **end );
|
函式 strtod() 返回在 start 中遇到的第一個雙精度浮點數。end 被設定為指向 start 中該雙精度浮點數之後剩餘的內容。如果發生溢位,strtod() 返回 HUGE_VAL 或 -HUGE_VAL。
x = strtod( "42.0is_the_answer" );
結果是 x 被設定為 42.0。