Re: How to append data in an existing buffer (in C language)




akarui.tomoda...@xxxxxxxxx wrote:

> I have a structure and one of the fields is a data buffer
> (myDestinationBuffer).
> I filled in the buffer by using memcpy() function as below:
>
> memcpy(&myDestinationBuffer, &mySourceData, myDataLength);
>
> Now I need to append 2 more bytes at the bottom of the
> "myDestinationBuffer", how can I do this ?
>
> Thanks in advance.

memcpy(&myDestinationBuffer[myDataLength], &myNewData, 2);

or

memcpy(myDestinationBuffer+myDataLength, &myNewData, 2);

.



Relevant Pages

  • How to append data in an existing buffer (in C language)
    ... I have a structure and one of the fields is a data buffer ... I filled in the buffer by using memcpy() function as below: ... memcpy(&myDestinationBuffer, &mySourceData, myDataLength); ... "myDestinationBuffer", ...
    (comp.programming)
  • How to append data in an existing buffer (in C language)
    ... I filled in the data buffer using the memcpy() function as below: ... After the "myDestinationBuffer" got filled, I like to append two more ... have an appropriate newsgroups line in your header for your mail to be seen, ...
    (comp.lang.c.moderated)
  • Re: How to append data in an existing buffer (in C language)
    ... > I filled in the data buffer using the memcpyfunction as below: ... in my example my_buf is declared as array of char. ... in the last memcpy. ... have an appropriate newsgroups line in your header for your mail to be seen, ...
    (comp.lang.c.moderated)
  • [PATCH] fix Jespers sg_page_free Bad page states
    ... sg_page_malloc clear the data buffer, ... More majordomo info at http://vger.kernel.org/majordomo-info.html ... Please read the FAQ at http://www.tux.org/lkml/ ... Prev by Date: ...
    (Linux-Kernel)