memcpy with startIndex? [英] memcpy with startIndex?

查看:188
本文介绍了memcpy with startIndex?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望从特定的起始点将特定长度的内容从一个缓冲区复制到另一个缓冲区。我检查了 memcpy(),但是它只需要复制内容的长度,而我也想指定起始索引。



有没有任何函数可以做到这一点,或者有什么好的办法用现有的 memcpy 函数?

  memcpy(& dst [ dstIdx],& src [srcIdx],numElementsToCopy * sizeof(Element)); 


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 to be copied while I want to specify the starting index too.

Is there any function which can do this or is there any good approach to do it with the existing memcpy function?

解决方案

I always prefer the syntax

memcpy( &dst[dstIdx], &src[srcIdx], numElementsToCopy * sizeof( Element ) );

这篇关于memcpy with startIndex?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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