strcpy

extern char *strcpy(char *dest,char *source);
{
    assert((dest!=NULL)&&(source!=NULL));

    char *address=dest;
    while((*dest++=*source++)!='\0');

    return address;
}

  把source所指由NULL结束的字符串复制到dest所指的数组中。source和dest所指内存区域不可以重叠且dest必须有足够的空间来容纳source的字符串。返回指向dest的指针。

memcpy

void *memcpy(void *dest, const void *source, size_t count)//没有对内存重叠进行检查
{
    assert((dest!=NULL)&&(source!=NULL));

    char* tmpDest=(char*)dest;
    char* tmpSource=(const char*)source;
    while(count--)
        *tmpDest++=*tmpSource++;
    return tmpDest;
}

memmove

  Copies the values of num bytes from the location pointed by source to the memory block pointed by destination. Copying takes place as if an intermediate buffer were used, allowing the destination and source to overlap

void* memmove(void* dest,const void* src,size_t num)
{
    assert((dest!=NULL)&&(src!=NULL));

    char* tmpDest=(char*)dest;
    char* tmpSrc=(const char*)src;

    if(src>dest||src+num<dest)
    {
        while(num--)
            *tmpDest++=*tmpSrc++;
    }
    else
    {
        tmpDest=dest+num-;
        tmpSrc=src+num-;
        while(num--)
            *tmpDest--=*tmpSrc--;
    }
    return dest;
}

最新文章

  1. Web性能测试工具JMeter
  2. JS中NULL和Undefined的区别
  3. OVER(PARTITION BY)函数介绍
  4. Java——正则表达式(字符串操作)
  5. (WF)
  6. 转:STL使用入门( Using STL)
  7. jquery 仿购物车的加减数量
  8. easyUI带复选框的组合树
  9. C#学习之设计模式:工厂模式
  10. Python可视化库-Matplotlib使用总结
  11. 一文搞定MySQL的事务和隔离级别
  12. C#线程同步--线程通信
  13. windows安装MongoDB副本集,通过Java程序实现数据的插入与查询
  14. Matplotlib学习---用matplotlib画折线图(line chart)
  15. [daily][device][archlinux][trackpoint] 修改指点杆速度/敏捷度
  16. redis问题:redis-server.exe双击闪退 win10系统
  17. Mybatis中的缓存
  18. PhpStorm破解版及使用教程
  19. ISO27001信息安全管理体系
  20. SpringBoot(十二)-- 整合Redis

热门文章

  1. SpringCloud学习笔记(二、SpringCloud Config)
  2. flag 履行我的flag
  3. 蓝牙Inquriy 过程详解
  4. 【STM32H7教程】第17章 STM32H7之GPIO的HAL库API
  5. kvm与xen虚拟化的比较(转)
  6. mysql多表关联update
  7. Laravel配置全局公共函数
  8. 列举常见国内外做服务器与存储的IT厂家
  9. solidity定长数组和动态数组
  10. 用Python查找数组中出现奇数次的那个数字