struct block1 { char version[64]; char comments[128]; char dummy[8]; long img_param_flag; long img_data_type; float invalid_point; long arr_width; long arr_height; long db_length; long scale; float iscale; float jscale; long trns_matrix_f; double trns_matrix[16]; long img_color; long clr_blk_length; long cam_pos_f; float cam_x; float cam_y; float cam_z; } *blk1;
*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:use strict; use Dumpvalue; use POSIX; sub dump_ref { my $ref = shift; my $dumper = new Dumpvalue; print "Content-Type:text/html\n\n"; print "<pre>"; $dumper->dumpValues($ref); print "</pre>"; exit; } # read in the 3D info. # use unpack to parse the structure my ($block1, $block2); open(FP, "<./file.pf") || die("Error opening file: $!\n"); binmode(FP); read(FP, $block1, 512); # 512 byte binary c structure # Note that the longs are in Network order my @block1_info = unpack("a64a128a8NNfNNNNffNd16NNNfffN30",$block1); dump_ref(\@block1_info); exit;
0 ARRAY(0x80d54b0) 0 "PIF Format v2.0" 1 "" 2 "" 3 0 4 1 5 0 6 149 7 78 8 139464 9 0 10 0 11 0 12 2 13 '3.03865194161742e-319' 14 0 15 0 16 0 17 0 18 0 19 '3.04497598188419e-319' 20 0 21 0 22 '3.03865194161742e-319' 23 0 24 0 25 0 26 0 27 0 28 '3.03865194161742e-319' 29 1 30 11622 31 1 32 0 33 0 34 0 35 0 36 0 37 0 38 0 39 0 40 0 41 0 42 0 43 0 44 0 45 0 46 0 47 0 48 0 49 0 50 0 51 0 52 0 53 0 54 0 55 0 56 0 57 0 58 0 59 0 60 0 61 0 62 0 63 0 64 0
In reply to C Struct Data Problem by heroin_bob
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |