• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            Jiwu Bu

              C++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              32 隨筆 :: 0 文章 :: 25 評論 :: 0 Trackbacks
            轉載鏈接:http://blog.chinaunix.net/u2/76292/showart_1845022.html

             1 #include <stdlib.h>
             2 #include <stdio.h>
             3 #include <ctype.h>
             4 
             5 long my_atol(const char *nptr)
             6 {
             7     int c; /* current char */
             8     long total; /* current total */
             9     int sign; /* if '-', then negative, otherwise positive */
            10 
            11     /* skip whitespace */
            12     while ( isspace((int)(unsigned char)*nptr) )
            13     {
            14         ++nptr;
            15     }
            16     
            17     c = (int)(unsigned char)*nptr++;
            18     sign = c; /* save sign indication */
            19     if (c == '-' || c == '+')
            20     {
            21         c = (int)(unsigned char)*nptr++/* skip sign */
            22     }
            23     
            24     total = 0;
            25 
            26     while (isdigit(c)) 
            27     {
            28         total = 10 * total + (c - '0'); /* accumulate digit */
            29         c = (int)(unsigned char)*nptr++/* get next char */
            30     }
            31 
            32     if (sign == '-')
            33     {
            34        return -total;
            35     }
            36     else
            37     {
            38         return total; /* return result, negated if necessary */
            39     }
            40 }
            41 
            42 int  main(int argc, char* argv[])
            43 {
            44     if( argc < 2 )
            45     {
            46         return -1;
            47     }
            48 
            49     int i = my_atol(argv[1]);
            50     printf("[%s]====>[%d]\n", argv[1], i);
            51    
            52     int j = atoi(argv[1]);
            53     printf("[%s]====>[%d]\n", argv[1], j);
            54 
            55     return 0;
            56 }
            57 
            http://www.shnenglu.com/Files/bujiwu/atoi.rar

            posted on 2010-01-15 17:52 bujiwu 閱讀(1428) 評論(0)  編輯 收藏 引用 所屬分類: 算法與數(shù)據(jù)結構
            狠狠狠色丁香婷婷综合久久俺| 久久综合久久性久99毛片| 久久综合亚洲色一区二区三区| 伊人久久大香线蕉AV色婷婷色| 日本久久中文字幕| 国内精品久久久久影院一蜜桃| 久久夜色精品国产亚洲| 国内精品久久国产| 99久久夜色精品国产网站| 亚洲日本久久久午夜精品| 久久国产成人精品麻豆| 久久久精品久久久久影院| 国产一区二区精品久久| 国产精品亚洲综合久久 | 亚洲午夜久久久久久噜噜噜| 1000部精品久久久久久久久| 久久久久国产视频电影| 99久久国产综合精品麻豆| 欧美日韩精品久久久免费观看| 精品一区二区久久久久久久网站| 久久精品国产亚洲av麻豆蜜芽 | 欧美久久精品一级c片片| 精品多毛少妇人妻AV免费久久| 超级碰久久免费公开视频| 久久永久免费人妻精品下载| 日韩电影久久久被窝网| 91精品国产综合久久四虎久久无码一级| 日产精品久久久久久久| 人妻中文久久久久| 久久精品夜色噜噜亚洲A∨| 久久精品国产亚洲麻豆| 久久无码人妻一区二区三区午夜| 伊人久久大香线蕉精品不卡| 久久精品无码一区二区三区日韩| 久久香蕉国产线看观看乱码| 久久国产亚洲精品麻豆| 久久国产乱子精品免费女| 伊人久久精品线影院| 久久国产成人亚洲精品影院 | 中文字幕乱码久久午夜| 久久人人爽人人爽人人片AV不 |