atoi function 将字符串转换成int型

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(int argc, char** argv)
{
    if(argc<2)
    {
        printf("error usage!
");
        exit(1);
    }
    int a = atoi(argv[1]);
    printf("you've input %s
, after atoi...",argv[1]);
    printf("you get %d
",a);
    return 0;
}
原文地址:https://www.cnblogs.com/yongjiuzhizhen/p/3431350.html