#include<iostream>
#include<string.h> //include memmove
int main()
{
char buffer[10]="12345";//必须声明缓冲区大小,不能char * buffer
memmove(&buffer[3],&buffer[2],3); //移动3个字符,因为字符串最后的\0
buffer[3]='.';
std::cout<<buffer<<std::endl;
}
跳入c++ 5 memmove 字符串截取
最新推荐文章于 2024-07-24 08:30:00 发布