• <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
            <2025年7月>
            293012345
            6789101112
            13141516171819
            20212223242526
            272829303112
            3456789

            常用鏈接

            留言簿(2)

            隨筆檔案(7)

            相冊

            搜索

            •  

            積分與排名

            • 積分 - 15805
            • 排名 - 952

            最新評論

            閱讀排行榜

            評論排行榜

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

            用法:#include <string.h>

            功能:由src所指內存區域復制count個字節到dest所指內存區域。

            說明:src和dest所指內存區域不能重疊,函數返回指向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中首次出現字符c的位置

            說明:返回首次出現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 復制

            ?

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

            ?

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

            ?

            void* memmove (void *s1, const void *s2, size_t len);
            當源單元和目的單元緩沖區交迭時使用

            ?

            size_t strxfrm (char *s1, const char *s1, size_t len);
            根據程序當前的區域選項, s2的前len個字符(字節)復制到s1中指定的地址, 不加'\0'

            ?


            2
            連接

            ?

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

            ?

            char* strncat (char *s1, const char *s2, size_t len);
            將字符串s2的前len個字符連接到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);
            s1s2的前len個字符(字節)作比較

            ?

            int strcoll (const char *s1, const char *s2);
            根據程序當前的區域選項中的LC_COLLATE, 比較字符串s1s2

            ?


            4
            查找

            ?

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

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

            ?

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

            ?

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

            ?

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

            ?

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

            ?

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

            ?

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

            ?


            5
            其他

            ?

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

            ?

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

            ?

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

            ?

            source: C & C++ Code Capsules
            posted on 2006-07-28 10:35 Bourne 閱讀(275) 評論(0)  編輯 收藏 引用
            精品久久久久久久国产潘金莲| 亚洲综合久久久| 久久久青草青青亚洲国产免观| 久久精品99久久香蕉国产色戒| 精品一区二区久久| 伊人色综合久久天天人守人婷| 无码伊人66久久大杳蕉网站谷歌| 99久久国产热无码精品免费久久久久| 亚洲国产精品狼友中文久久久| 久久午夜羞羞影院免费观看| 国产午夜精品久久久久九九电影| 久久久久久国产精品无码下载 | 久久久国产精品福利免费| 国产精品无码久久综合网| 亚洲va久久久噜噜噜久久男同 | 99精品国产免费久久久久久下载| AAA级久久久精品无码片| 无码乱码观看精品久久| 久久精品国产免费一区| 久久午夜伦鲁片免费无码| 亚洲欧洲久久久精品| 久久精品国产亚洲AV不卡| 久久精品国产亚洲av影院| 精品国产青草久久久久福利| 久久久久综合国产欧美一区二区| 国内精品久久久久影院日本| 久久久无码精品亚洲日韩蜜臀浪潮 | 久久夜色精品国产亚洲| 青青青青久久精品国产h久久精品五福影院1421 | 18岁日韩内射颜射午夜久久成人| 一本一本久久aa综合精品| 久久这里的只有是精品23| 久久青青草原精品国产不卡| 国产免费久久久久久无码| 青青青国产精品国产精品久久久久 | 伊人久久五月天| 亚洲欧美国产精品专区久久 | 亚洲国产精品无码久久SM | 久久久久高潮综合影院| 久久综合亚洲色一区二区三区| 亚洲精品无码专区久久同性男|