I am trying to import a binary data file. It seems that BinaryReadList would be appropriate? However the data file is composed of c++ structures like this:

struct data1 {
    uint8_t    field1;
    uint16_t   field2;
    uint32_t   field3;

struct data2 {
    uint16_t   field1;
    uint16_t   field2;
    uint8_t    field3;
    uint32_t   field4;

struct data {
    data1  entry1;
    data2  entry2;
    data2  entry3[10];

int main() {

data myData[100];


Is there a way to specify the expected input format to read the data appropriately? I couldn't find a decent solution to import these data with Mathematica ?

  • 4
    $\begingroup$ Have you tried the third syntax format of BinaryReadList (BinaryReadList["file",{type1,type2,...}])? If so, did it work for you or did you encounter any problems? $\endgroup$ Commented Aug 30, 2015 at 20:26
  • $\begingroup$ Thx a lot , i did overlook this option :) $\endgroup$
    – bernddude
    Commented Aug 31, 2015 at 2:08

1 Answer 1


As per the comment, the third syntax format of BinaryReadList does what is required:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.