Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^5: converting artibrary binary data to numeric values

by Corion (Pope)
on Oct 02, 2012 at 07:18 UTC ( #996817=note: print w/replies, xml ) Need Help??

in reply to Re^4: converting artibrary binary data to numeric values
in thread converting artibrary binary data to numeric values

If you just want "the values", then keep them as strings. If that seems problematic, you have to show some code where you show how you acquire the data (say, from initializing a string), how you unpack it, and what you want to do with it in the end.

If you want "the values" as "number", then you have to unpack them from the string. As long as you are dealing with four-byte numbers, or your Perl and the C program have the same interpretation of the long type, there will be no loss of accuracy.

As for your questions about alignment etc., that is what Convert::Binary:C is set up to handle.

Replies are listed 'Best First'.
Re^6: converting artibrary binary data to numeric values
by markle (Initiate) on Oct 02, 2012 at 20:31 UTC
    Turns out my debug routine was the thing splitting from string representations of the decimal values. Unpack and Convert::Binary::C were working fine. Dunce cap. :-) Binary makes me woozy.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://996817]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2016-10-23 12:42 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (301 votes). Check out past polls.