跳轉到內容

C++ 程式設計/程式碼/標準 C 庫/函式/atol

來自華夏公益教科書,開放的書籍,開放的世界
語法
#include <cstdlib>
long atol( const char *str );

atol() 函式將 str 轉換為 long,然後返回該值。atol() 將從 str 中讀取,直到找到任何不應出現在 long 中的字元。然後將截斷後的結果值轉換並返回。例如,

x = atol( "1024.0001" );

將導致 x 設定為 1024L。

相關主題
atof - atoi - strtod
(標準 C I/O) sprintf
華夏公益教科書