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!\n");
        exit(1);
    }
    int a = atoi(argv[1]);
    printf("you've input %s\n, after atoi...",argv[1]);
    printf("you get %d\n",a);
    return 0;
}

 

posted @ 2013-11-19 13:50  永久指针  阅读(222)  评论(0编辑  收藏  举报