Click here to Skip to main content
14,692,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.


1 solution

Yes, its possible:

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


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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900