C++ 程式設計/程式碼/標準 C 庫/函式/strtol
外觀
| 語法 |
#include <cstdlib>
long strtol( const char *start, char **end, int base );
|
strtol() 函式將 start 中遇到的第一個字元轉換為長整型,必要時進行 base 進位制轉換。end 指標指向 start 中長整型轉換完成後剩下的部分。如果結果無法用長整型表示,則 strtol() 返回 LONG_MAX 或 LONG_MIN。出錯時返回零。