Split binary data every nth byte?

I am reading an array of data from a BinaryStream, and is it possible with Xojo to split the read data every number of bytes? For example:

Hex Data: C5 C3 C9 C8 C10 B11 F35 D22 E33 R44 T55 Y66.
Basically, I want this data split every fourth byte. So this is what it would look like after the split:
(C5 C3 C9 C8) (C10 B11 F35 D22) (E33 R44 T55 Y66)

Give me some ideas on how to do this.

Depending on what you want to do with the data you could read four-byte integers (readitnt32 or readUint32) directly from the binarystream. You could also use a memoryblock to store the data and then read the four byte integers using Int32Value or Uinte32Value. The difference is that if you are reading the data from the binarystream it must be done secuencially whereas when reading it from the memory block you have control over the position you want to read.

Julen

“C10 B11 F35 D22 E33 R44 T55 Y66”

HEX values? I’m assuming you just wrote something quickly as an example… because those aren’t valid HEX values.

[quote=58719:@Julen Ibarretxe Uriguen]Depending on what you want to do with the data you could read four-byte integers (readitnt32 or readUint32) directly from the binarystream. You could also use a memoryblock to store the data and then read the four byte integers using Int32Value or Uinte32Value. The difference is that if you are reading the data from the binarystream it must be done secuencially whereas when reading it from the memory block you have control over the position you want to read.

Julen[/quote]

Thanks :slight_smile:

[quote=58832:@Eric Brown]“C10 B11 F35 D22 E33 R44 T55 Y66”

HEX values? I’m assuming you just wrote something quickly as an example… because those aren’t valid HEX values.[/quote]

Yep, those values are just example values.