Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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.


Comment on Re^5: converting artibrary binary data to numeric values
Download Code
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2014-09-16 21:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (50 votes), past polls