memmove函数的使用方法

/*-------------------------
memmove
语法:

#include <string.h>
void *memmove( void *to, const void *from, size_t count );

The memmove() function is identical to memcpy(), except that it works even if to and from overlap. 
功能: 与mencpy相同,不同的是当to 和 from 重叠,函数仍能正常工作。
----------------------------*/

#include 
using namespace std;

int main( void )
{
 	char* str = "ok2002.com, C++ program";
 	const int len = strlen( str ) + 1 ;
 	char buf[len];
 	
 	memmove( buf, str, len );
 	buf[len] = '\0';
 	cout << buf << endl;
 	
 	system( "pause" );
	return 0;
}


★参考资料★ 
http://www.ok2002.com/cc/html/16fl1wbu95jve64fodihxkkr3-c4r88g7n.d0m0wo7ag9uzb3tn5lvz2msteihs_.html

你可能感兴趣的:(C++)