comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Putting bytes into structures
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Putting bytes into structures [message #10101] Wed, 22 October 1997 00:00
jackel[1] is currently offline  jackel[1]
Messages: 11
Registered: May 1997
Junior Member
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Return statement must have 1 value?
Next Topic: GRAFFER and IDL 5.0

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 14:21:57 PDT 2025

Total time taken to generate the page: 0.00552 seconds