跳轉至內容

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。

相關主題
atof
華夏公益教科書