comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Putting bytes into structures

Putting bytes into structures
type: item
description: Greetings Here's a question for the collective wisdom: What's the best way to load a given number of bytes into a structure? That is, suppose I have some complex structure with floats and strings and vectors of longints. Then suppose that I have a bytearray that contains all the information in that structure. How do I put these bytes into the structure? One way to do this would be write the bytearray to a temporary file, then read it into the structure. This is very slow. Alternatively, one could walk through each tag in the structure, find out how many bytes it needed, grab that amount from the bytearray, then cast them to the proper type. Faster, but not exactly elegant. Ideally, there would be something like READS that would allow unformatted reading from a bytearray instead of formatted reading from a string. If anyone has clever ideas (or obvious pointers to documentation that I've overlooked) please let me know. Brian Jackel
creator: jackel[1]
date: 1997-10-22T07:00:00-00:00