`
mx19841031
  • 浏览: 74796 次
  • 性别: Icon_minigender_2
  • 来自: 西安
社区版块
存档分类
最新评论

memmove

阅读更多

编写函数_memmove。说明如下:
实现C 语言库函数memmove 的功能:将一块缓冲区中的数据移动到另一块缓冲区中。
void* _memmove(void* pDest, const void* pSrc, size_t count);
说明:
(1) 关于memmove 的说明可查阅MSDN。
(2) 必须自行实现相关功能,不得直接调用memmove、memcpy 之类的库函数。

 

#include <iostream.h>


//缓冲区移动函数
void *memmove( void *dest, const void *src, int count )
...{
    
void *ret = dest;
    
while(count--)
    
...{
        
*(char*)dest = *(char *)src;
        dest 
= (char *)dest+1;
        src 
= (char *)src+1;
    }

    
return ret;
}



void main()
...{
    
char a[6= "world";
    
char b[6] ;
    
char *temp = (char *)memmove(b,a,6);
    
while(*temp!='
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics