• <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++博客 :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              32 隨筆 :: 0 文章 :: 25 評(píng)論 :: 0 Trackbacks
            轉(zhuǎn)載鏈接: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://m.shnenglu.com/Files/bujiwu/atoi.rar

            posted on 2010-01-15 17:52 bujiwu 閱讀(1436) 評(píng)論(0)  編輯 收藏 引用 所屬分類: 算法與數(shù)據(jù)結(jié)構(gòu)
            亚洲国产成人久久一区WWW| 一本一本久久a久久精品综合麻豆| 久久亚洲高清观看| 国产精品岛国久久久久| 国产福利电影一区二区三区,免费久久久久久久精| 久久精品国产亚洲av高清漫画| 久久青草国产精品一区| 久久精品国产色蜜蜜麻豆 | 久久婷婷国产综合精品| 久久精品成人免费观看97| 亚洲精品97久久中文字幕无码| 久久综合九色综合网站| 久久国产精品-国产精品| 中文字幕乱码人妻无码久久| 久久久久久亚洲精品不卡| 一本久久a久久精品亚洲| 狠狠色综合网站久久久久久久| 久久精品九九亚洲精品天堂| 亚洲欧美另类日本久久国产真实乱对白| 久久久久久久久久久| 久久精品视频一| 亚洲欧洲精品成人久久奇米网| 久久精品国产亚洲av高清漫画| 久久93精品国产91久久综合| 久久久久亚洲AV片无码下载蜜桃| 久久免费大片| 久久久久久国产精品美女| 国产精品熟女福利久久AV| 国产亚洲精品美女久久久| 久久人人爽爽爽人久久久| 亚洲精品无码久久不卡| 99久久夜色精品国产网站| 国产精品岛国久久久久| 青青草原精品99久久精品66| 漂亮人妻被中出中文字幕久久| 国产精品丝袜久久久久久不卡| 久久亚洲精品视频| 久久―日本道色综合久久| 久久久久人妻精品一区二区三区| 久久婷婷五月综合97色一本一本| 欧美一区二区三区久久综 |