• <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>
            隨筆 - 7  文章 - 15  trackbacks - 0
            <2006年7月>
            2526272829301
            2345678
            9101112131415
            16171819202122
            23242526272829
            303112345

            常用鏈接

            留言簿(2)

            隨筆檔案(7)

            相冊(cè)

            搜索

            •  

            積分與排名

            • 積分 - 15783
            • 排名 - 953

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            原型:extern void *memcpy(void *dest, void *src, unsigned int count);

            用法:#include <string.h>

            功能:由src所指內(nèi)存區(qū)域復(fù)制count個(gè)字節(jié)到dest所指內(nèi)存區(qū)域。

            說(shuō)明:src和dest所指內(nèi)存區(qū)域不能重疊,函數(shù)返回指向dest的指針。

            舉例:

            // memcpy.c

            #include <syslib.h>
            #include <string.h>

            main()
            {
            char *s="Golden Global View";
            char d[20];

            clrscr();

            memcpy(d,s,strlen(s));
            d[strlen(s)]=0;
            printf("%s",d);

            getchar();
            return 0;
            }

            原型:extern char *strchr(char *s,char c);

            用法:#include <string.h>

            功能:查找字符串s中首次出現(xiàn)字符c的位置

            說(shuō)明:返回首次出現(xiàn)c的位置的指針,如果s中不存在c則返回NULL。

            舉例:


            // strchr.c

            #include <syslib.h>
            #include <string.h>

            main()
            {
            char *s="Golden Global View";
            char *p;

            clrscr();

            strchr(s,'V');
            if(p)
            printf("%s",p);
            else
            printf("Not Found!");

            getchar();
            return 0;
            }

            1 復(fù)制

            ?

            char* strcpy (char *s1, const char *s2);
            將字符串s2復(fù)制到s1指定的地址

            ?

            char* strncpy (char *s1, const char *s2, size_t len);
            void* ?memcpy (void *s1, const void *s2, size_t len);
            s2的前len個(gè)字符(字節(jié))復(fù)制到s1中指定的地址, 不加'\0'

            ?

            void* memmove (void *s1, const void *s2, size_t len);
            當(dāng)源單元和目的單元緩沖區(qū)交迭時(shí)使用

            ?

            size_t strxfrm (char *s1, const char *s1, size_t len);
            根據(jù)程序當(dāng)前的區(qū)域選項(xiàng), s2的前len個(gè)字符(字節(jié))復(fù)制到s1中指定的地址, 不加'\0'

            ?


            2
            連接

            ?

            char* strcat (char *s1, const char *s2);
            將字符串s2連接到s1尾部

            ?

            char* strncat (char *s1, const char *s2, size_t len);
            將字符串s2的前len個(gè)字符連接到s1尾部, 不加'\0'

            ?


            3
            比較

            ?

            int strcmp (const char *s1, const char *s2);
            比較字符串s1s2

            ?

            int strncmp (const char *s1, const char *s2, size_t len);
            int ?memcmp (const void *s1, const void *s2, size_t len);
            對(duì)s1s2的前len個(gè)字符(字節(jié))作比較

            ?

            int strcoll (const char *s1, const char *s2);
            根據(jù)程序當(dāng)前的區(qū)域選項(xiàng)中的LC_COLLATE, 比較字符串s1s2

            ?


            4
            查找

            ?

            char* strchr (const char *s, int ch);
            void* memchr (const void *s, int ch, size_t len);

            s中查找給定字符(字節(jié)值)ch第一次出現(xiàn)的位置

            ?

            char* strrchr (const char *s, int ch);
            在串s中查找給定字符ch最后一次出現(xiàn)的位置, r表示從串尾開始

            ?

            char* strstr (const char *s1, const char *s2);
            在串s1中查找指定字符串s2第一次出現(xiàn)的位置

            ?

            size_t strspn (const char *s1, const char *s2);
            返回s1中第一個(gè)在s2中不存在的字符的索引(find_first_not_of)

            ?

            size_t strcspn (const char *s1, const char *s2);
            返回s1中第一個(gè)也在s2中存在的字符的索引(find_first_of)

            ?

            char* strpbrk (const char *s1, const char *s2);
            strcspn類似, 區(qū)別是返回指針而不是索引

            ?

            char* strtok (char *s1, const char *s2);
            從串s1中分離出由串s2中指定的分界符分隔開的記號(hào)
            (token)
            第一次調(diào)用時(shí)s1為需分割的字串, 此后每次調(diào)用都將s1置為
            NULL,
            每次調(diào)用strtok返回一個(gè)記號(hào), 直到返回NULL為止

            ?


            5
            其他

            ?

            size_t strlen (const char *s);
            求字符串s的長(zhǎng)度

            ?

            void* memset (void *s, int val, size_t len);
            將從s開始的len個(gè)字節(jié)置為val

            ?

            char* strerror (int errno);
            返回指向錯(cuò)誤信息字符串的指針

            ?

            source: C & C++ Code Capsules
            posted on 2006-07-28 10:35 Bourne 閱讀(273) 評(píng)論(0)  編輯 收藏 引用

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


            久久狠狠爱亚洲综合影院 | 一本久久a久久精品vr综合| 亚洲精品无码久久久久去q| 久久久婷婷五月亚洲97号色| 久久综合综合久久狠狠狠97色88 | 亚洲国产精品久久久久婷婷老年| 欧美激情精品久久久久| 一本综合久久国产二区| 久久青青草原国产精品免费| 久久综合久久美利坚合众国| 久久国产一区二区| 99精品国产99久久久久久97| 国产成人精品久久综合| 久久精品亚洲中文字幕无码麻豆| 久久精品夜色噜噜亚洲A∨| 国产亚洲欧美精品久久久| 欧美噜噜久久久XXX| 久久笫一福利免费导航| 88久久精品无码一区二区毛片| 99久久精品国产一区二区| 国产精品无码久久综合网| 久久精品中文闷骚内射| 国产偷久久久精品专区| 思思久久99热免费精品6| 国内精品伊人久久久久网站| 久久电影网一区| 国产精品99久久精品| 精品无码久久久久国产| 香蕉久久夜色精品升级完成| 久久精品国产乱子伦| 久久无码AV一区二区三区| 亚洲Av无码国产情品久久| 精品久久久久久久久久中文字幕 | 热re99久久精品国99热| 午夜精品久久久久久99热| 久久精品国产免费观看三人同眠| 久久婷婷色综合一区二区| 亚洲中文字幕久久精品无码喷水| 久久久久久综合网天天| 亚洲愉拍99热成人精品热久久| 色偷偷偷久久伊人大杳蕉|