title: Finding specific primitives within a binary file
body: <p>Is there any ways to find a specific primitive within a binary file(such as fread in MATLAB or BinaryReadLists in Mathematica)?  Specifically,  I want to scan my file until it reaches, say a int8_t precision number, then store it in a variable, then scan for another primitive(unsigned char, double, etc..)?</p>
  
  <p>I am rewriting code from MATLAB that does this, so the format of the file is known. </p>
  
  <p>I want to read n bytes of only the specified type (32-bit int, char, ..) in a file. Ex: Read only the first 12 bytes of my file if they return to be 8-bit integers</p>