1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > C语言里的几个拷贝函数memcpy memset strcpy strncpy

C语言里的几个拷贝函数memcpy memset strcpy strncpy

时间:2019-04-03 01:44:06

相关推荐

C语言里的几个拷贝函数memcpy memset strcpy strncpy

#include<string.h>

1.src和dest所指内存区域不能重叠,函数返回指向dest的指针。memcpy用来做内存拷贝,你可以拿它拷贝任何数据类型的对象,可以指定拷贝的数据长度

void*memcpy(>constvoid *src,size_tcount);

2.把buffer所指内存区域的前count个字节设置成字符c.说明:返回指向buffer的指针。

void*memset ( void *dest, intc ,size_tcount);

3.srcdest所指内存区域不可以重叠且dest必须有足够的空间来容纳src的字符串

char *strcpy ( char *strDestination,const char *strSource);

wchar_t *wcscpy ( wchar_t*strDestination,const wchar_t*strSource);

unsigned char *_mbscpy( unsigned char *strDestination, constunsigned char *strSource);

4.把src所指示的以'\0'结尾的字符串的前n个字节复制到dest所指的数组中。复制时连同字符串的'\0'一起被复制。

char*strncpy (char*strDest,const char *strSource,size_tcount);

wchar_t *wcsncpy ( wchar_t *strDest,const wchar_t*strSource,size_tcount);

unsigned char *_mbsncpy (unsigned char *strDest,const unsigned char *strSource,size_tcount);

STRING.H

#ifdef _M_MRX000

_CRTIMP void * __cdecl memcpy(void *, const void *, size_t);

_CRTIMP int __cdecl memcmp(const void *, const void *, size_t);

_CRTIMP void * __cdecl memset(void *, int, size_t);

_CRTIMP char * __cdecl _strset(char *, int);

_CRTIMP char * __cdecl strcpy(char *, const char *);

_CRTIMP char * __cdecl strcat(char *, const char *);

_CRTIMP int __cdecl strcmp(const char *, const char *);

_CRTIMP size_t __cdecl strlen(const char *);

#else

void * __cdecl memcpy(void *, const void *, size_t);

int __cdecl memcmp(const void *, const void *, size_t);

void * __cdecl memset(void *, int, size_t);

char * __cdecl _strset(char *, int);

char * __cdecl strcpy(char *, const char *);

char * __cdecl strcat(char *, const char *);

int __cdecl strcmp(const char *, const char *);

size_t __cdecl strlen(const char *);

#endif

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。