title: How can I handle packed data from Perl/PHP in C++?
body: <p>I got a problem implementing a PHP programm in C++. It is about the PHP/Perl function <a href="http://www.php.net/manual/function.unpack.php" rel="nofollow noreferrer">unpack</a>. I don't know how to do the follwing in C++ (no problem in reading a file... but how do i unpack("C*") the read contents).</p>
  
  <pre><code>&lt;?php
  $file = fopen("bitmaskt.dat", "rb");
  //create the data stream
  $matrix_x           = unpack("C*", fread($file, 286));
  $matrix_y           = unpack("C*", fread($file, 286));
  $mask_data          = unpack("C*", fread($file, 286));
  $reed_ecc_codewords = ord(fread($file, 1));
  $reed_blockorder    = unpack("C*", fread($file, 128));
  fclose($file);
  ?&gt;
  </code></pre>
  
  <p>Currently, I'm very hopeless solving this problem on my own - I'm searching for days, all I found are questions... Is there any free unpack() c++ implementation out there? :-( </p>