How to split a byte array

前端 未结 7 1795
一个人的身影
一个人的身影 2020-12-03 20:20

I have a byte array in memory, read from a file. I would like to split the byte array at a certain point (index) without having to just create a new byte array and copy eac

7条回答
  •  伪装坚强ぢ
    2020-12-03 21:21

    You can't. What you might want is keep a starting point and number of items; in essence, build iterators. If this is C++, you can just use std::vector and use the built-in ones.

    In C#, I'd build a small iterator class that holds start index, count and implements IEnumerable<>.

提交回复
热议问题