-1

I have an array:

byte[] element = new byte[16];

Which needs to be a part of a collection and saved in a file, byte-by-byte. This file is to be read by another application written in C++.

I could use an array or arrays:

byte[][] elementlist;

Or a list:

List<byte[]> elementlist;

Please explain:

  • Which structure is easier for a C++ Application to read with the least effort.

  • Which is the overall faster procedure (if performance difference is not negligible) when trying to access them later in any language.

  • In the given situation, what in your opinion should be the preferred method to pack the collection of bytes? If you have any other suggestions that I've not mentioned here, please feel free to share.

Thanks.

Samik Sengupta
  • 1,944
  • 9
  • 31
  • 51
  • 1
    Try to serialize both and answer your question yourself. It's the first thing you should have done when made your own research. – zerkms Mar 31 '15 at 05:58
  • So apparently asking for opinions is wrong? – Samik Sengupta Mar 31 '15 at 06:00
  • It's not wrong. What is wrong is not bringing any effort trying to solve it first. – zerkms Mar 31 '15 at 06:13
  • This is not a problem to "solve" in the regular sense. This are the options that I have and I was just wondering which is the route veterans would take. Also, asking opinions from the veterans is also "research". – Samik Sengupta Mar 31 '15 at 06:19

1 Answers1

1

Arrays are faster and easier to handle, because you can directly access the memory. If you have a list you always having pointers, which is slower than a direct array access.

More information about that topic can be found here: array vs vector vs list

Community
  • 1
  • 1
Manuel
  • 88
  • 8