#include <cstdlib> long atol( const char *str );
atol() 函式將 str 轉換為 long,然後返回該值。atol() 將從 str 中讀取,直到找到任何不應出現在 long 中的字元。然後將截斷後的結果值轉換並返回。例如,
x = atol( "1024.0001" );
將導致 x 設定為 1024L。