memmove
编写函数_memmove。说明如下:实现C 语言库函数memmove 的功能:将一块缓冲区中的数据移动到另一块缓冲区中。
void* _memmove(void* pDest, const void* pSrc, size_t count);
说明:
(1) 关于memmove 的说明可查阅MSDN。
(2) 必须自行实现相关功能,不得直接调用memmove、memcpy 之类的库函数。
<div style="padding-right: 5.4pt; padding-left: 5.4pt; background: #e6e6e6; padding-bottom: 4px; width: 95%; padding-top: 4px;">http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif#include <iostream.h>
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif//缓冲区移动函数
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifvoid *memmove( void *dest, const void *src, int count )
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif void *ret = dest;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif while(count--)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif ...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif *(char*)dest = *(char *)src;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif dest = (char *)dest+1;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif src = (char *)src+1;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif }
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif return ret;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifvoid main()
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif char a[6] = "world";
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif char b[6] ;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif char *temp = (char *)memmove(b,a,6);
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif while(*temp!='
页:
[1]