跳转到内容

atoi, atol : 字符串转整数

#include <stdlib.h>
int atoi(const char *s);
long atol(const char *s);
```### 描述
atoi 将字符串的初始部分转换为 int。atol 将字符串的初始部分转换为 long。atoi(s) 实现为 (int)strtol(s, NULL, 10)。atol(s) 实现为 strtol(s, NULL, 10)。### 返回值
这些函数返回转换后的值(如果有)。如果未进行任何转换,则返回 0。
---
**权威来源**: BUSMASTER DITA help source `atoi.dita`, compiled into `BUSMASTER.CHM` with the application.