Don't ask to ask, just ask | |
PerlMonks |
C Struct Data Problemby heroin_bob (Sexton) |
on May 17, 2005 at 17:04 UTC ( [id://457900]=perlquestion: print w/replies, xml ) | Need Help?? |
heroin_bob has asked for the wisdom of the Perl Monks concerning the following question:
Gracious Monks,
I'm writing a simple utility to convert 3D vertex information from one file format to another. While reading and parsing the file information I can't seem to figure out why I'm getting very wierd information. For example in a variable that acts as a flag and it's values could be 0-2 it comes in as an arbitrary number in the billions.
Since the file structure is documented as a series of C structs, I tried writing the utility in C which yielded worse results than Perl. At least with Perl I get about 1/4 of the fields back with correct information. Any help or guidance in the right direction would be most appreciated. Here's the code and header structure I'm working with: *----------- C Code --------------*
*----------- Perl Code --------------* *UPDATE* Apparently the only one coming in erroneous (in Perl) is the transformation matrix... the array of 16 doubles. I'm getting numbers like "3.03865194161742e-319" and when I apply them to the data I get numbers even smaller. Indices 13-28 is what I'm referring to... it's a 4 X 4 transformation matrix for conversion to another coordinate system. Here's a dump of the info I'm getting back:
~hb
Back to
Seekers of Perl Wisdom
|
|