memcpy with startIndex?

后端 未结 9 1237
星月不相逢
星月不相逢 2020-12-24 11:31

I wish to copy content of specific length from one buffer to another from a specific starting point. I checked memcpy() but it takes only the length of content

9条回答
  •  温柔的废话
    2020-12-24 12:12

    Just add the offset you want to the address of the buffer.

    char abuff[100], bbuff[100];
    ....
    memcpy( bbuff, abuff + 5, 10 );
    

    This copies 10 bytes starting at abuff[5] to bbuff.

提交回复
热议问题