Deserializing varying quantity of binary data

  • Thread starter Thread starter Kevin R
  • Start date Start date
K

Kevin R

Hi All,

I have a binary file, the first few k of which contains some
information which I need to stick in to an array of types,let's call
them Wongas.
Each Wonga is made up of two ulongs and a 24 byte character array.

I need to read in an array of Wongas from the binary file and I need
to specify how many to read in, as the file is only Wongas for the
first few k .What's more, the wongas don't start at the beginning of
the file, they are a few bytes in

In C I could just set the file pointer and then read in a set number
of Wongas in to an array of structures using one read() function.

I am seeing examples of deserializing arrays of Wongas, using the
Deserialize method of the BinaryFormatter, but I don't see a way of
setting the number of wongas retrieved. I get the impression it just
carries on till the end of the file, and as the file is nearly a Giga
byte, that could cause problems.

Any ideas ?

TIA

Kevin R.
 
Back
Top