title: What are some ways to parse binary data with a repeating structure?
body: <p>I have written some output files which have a large number of data sets of identical format. For example, 10,000 sets of 200 doubles. I used the write command:  </p>
  
  <p>loop over 10000 (# sets)<br>
  loop over 200 (size of each set)<br>
  and did this:</p>
  
  <pre><code>outputfile.write(reinterpret_cast&lt;const char*&gt;(&amp;onedouble),sizeof(onedouble));  
  </code></pre>
  
  <p>I don't have a sense of the easiest ways to read this type of data. I need to look at each individual set one at a time. I have read that generally reading binary data is done all at once into a large block of memory, but I'm not sure how to parse it after that. What are some ways to do that?</p>
  
  <p>Is it significantly slower to read one set of data at a time from the binary file? I have not seen any examples of that type of input.</p>