Chinaunix首页 | 论坛 | 博客
  • 博客访问: 313409
  • 博文数量: 69
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 759
  • 用 户 组: 普通用户
  • 注册时间: 2014-09-09 14:15
个人简介

〆 人生就是拼命地奔跑,和华丽的跌倒。 つ

文章分类

全部博文(69)

文章存档

2017年(2)

2016年(16)

2015年(21)

2014年(30)

分类: C/C++

2015-05-09 21:06:53

1. 在src所指内存区域复制n个字节到dest所指内存区域;
2. src和dest所指内存区域不能重叠,函数返回指向dest的指针。

3. memccpy()与strncpy()的区别:

   (1)strncpy是把n个字符从src中复制到dest中,src和dest地址不能重叠。
   (2)memccpy把n个字符从src中复制到dest中,它为内存复制,不管是不是 NULL(空值),通用。

memccpy手册

MEMCCPY(3)                 Linux Programmer’s Manual                MEMCCPY(3)

NAME
       memccpy - copy memory area
       //内存拷贝

SYNOPSIS
       #include
       //包含头文件

       void *memccpy(void *dest, const void *src, int c, size_t n);

DESCRIPTION
       The memccpy() function copies no more than n bytes from memory area src
       to memory area dest, stopping when the character c is found.
      //memccpy()函数从源代码内存区域中仅仅拷贝n个字节,送到目的代码的内存区域
      中,当参数c建立后停止。

       If the memory areas overlap, the results are undefined.
       //如果内存中内容重复了,那么结果是不明确的。

RETURN VALUE
       The memccpy() function returns a pointer to the next character in  dest
       after c, or NULL if c was not found in the first n characters of src.
      //参数c出现后,memccpy()函数则返回dest中值为c的下一个字符地址,如
       果在源代码的n个字符中没有发现c( int c)就为空值。

CONFORMING TO
       SVr4, 4.3BSD, POSIX.1-2001.

SEE ALSO
       bcopy(3), memcpy(3), memmove(3), strcpy(3), strncpy(3)

COLOPHON
       This  page  is  part of release 3.22 of the Linux man-pages project.  A
       description of the project, and information about reporting  bugs,  can
       be found at
      //这篇是linux3.22版本手册项目中的一部分。一个项目的描述,还有关于
      漏洞信息的报告都会在找到。

GNU                               2009-01-13                        MEMCCPY(3)

阅读(1415) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~