Here's the situation. I've got some data. It contains a text header and then one long string of binary data that represents numerous samples of data. I have a script that pulls off the header, and then begins to read the binary data. Depending on the type of data, each data point is n-bytes long. I take this into account. I read in, let's say 2 bytes, split them, ord each and reassemble the two numbers so that I have the value for the data point. All of this works fine in linux. However, when I run the same script in DOS (I'm using active state perl for the DOS part), it inevitably finds a byte that seems to indicate EOF for it. I've looked at the byte values in linux and DOS and they match until the hose up. The last byte that DOS gets is FDh. The one that it seems to trip up on is 1Ah which is actually SUB (substitute). It's my understanding that if you open a file in DOS you have to specify that it is a binary file or this type of control character error will occasionally (inevitably?) occur. So my question is this, how do I tell my filehandle, in the DOS implementation, that the file it points to is a binary file, not a text file? Or is my problem something else I haven't thought of?

In reply to perl in DOS woes by manzico

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.