The hardest part of this task is determining exactly what you need. I suggest that you write a program in "C" that writes a sample file. Verify that this file can be read correctly. When you have a working sample, examine it with a hex editor to answer several questions. Are there any extra characters in the file (e.g. newlines)? Is your understanding of "single" and "double" precision correct? Is the data "big endian"? Are the "nibbles" swapped within each byte? Given the answers to these questions, it should not be hard to write the correct format for 'pack'. Now try to write the same data with perl. Examine the output file with your hex editor. It should be identical to the one you made with "C". If not, how is it different? If you still need help, post the hex dumps of the two files. It probably would help if you also post the "C" and perl programs you used to create them.
Bill

In reply to Re: Perl binary file by BillKSmith
in thread Perl binary file by kepler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.