字符缓冲区追加 [英] char buffer append

查看:70
本文介绍了字符缓冲区追加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有两个大小不同的字符缓冲区.

例如,现有缓冲区的大小为40,第二个缓冲区的大小为50.

我想做的是,创建一个新缓冲区,其中应包含第一个缓冲区(位置从0到40)和第二个缓冲区(位置从41到91)中的数据.

我的意思是第二个缓冲区的数据应该附加第一个缓冲区的数据.

有什么办法吗?您能帮我吗?

Thanx.

Hi all,

Im having two character buffers with different size.

for ex,ist buffer is size of 40,and 2nd one is 50.

what im trying to do is,create the new buffer which should contain the data from first buffer(position from 0 to 40)and the data from the 2nd buffer(position from 41 to 91).

I mean the 2nd buffer''s data should get append with the first buffer data.

Is any way to do this?could you help me.

Thanx.

推荐答案

是的,可能的是:

Yes, its possible:

char first[40];
char second[50];
char third[90];

...

memcpy(&third[0], first, 40);
memcpy(&third[40], second, 50);


这篇关于字符缓冲区追加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆