[英]Copying contents of a char array into another
How do I get the contents from one character buffer into another? 如何将内容从一个字符缓冲区转移到另一个字符缓冲区? For instance I have
例如我有
char buffer[SMALLVALUE];
char new_buffer[BIGGERVALUE];
I'd like to copy the contents of buffer
into new_buffer
. 我想将
buffer
的内容复制到new_buffer
。 What's the shortest way to do this? 最简单的方法是什么?
#include <string.h>
memcpy(new_buffer, buffer, sizeof buffer);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.