On Jul 23, 4:17=A0am, m...@[EMAIL PROTECTED]
wrote:
> In a previous article, GaryScott <garylsc...@[EMAIL PROTECTED]
> wrote:
>
>
>
> >On Jul 23, 8:44=3DA0am, badger <mdeka...@[EMAIL PROTECTED]
> wrote:
> >> On 23 Jul, 08:08, m...@[EMAIL PROTECTED]
wrote:
>
> =A0<snip>
> >> > >As I said I think that the way I have approached it thus far is ok
=
-
> >> > >open file read header, close file, reopen file and try and read
> >> > >binary. Only I have no idea how to read the binary part - I can't
s=
eem
> >> > >to skip over the binary bit!!
>
> >> > >Thanks.
>
> >> > =3DA0 Depends what binary means - sometimes that will have record
si=
zes.
> >> > Anyway - assuming it is "straight binary" - I.e. you can
> >> > read in any amount anytime and not lose anything,
> >> > I would suggest reading the header unformatted- as a
> >> > array of bytes - which could be equivalenced to a string,
> >> > on wbich you could do an internal read.
> >> > Chris
>
> >> Thanks - but...
> >> As I said and showed in my code - I can read the header bit fine. I
> >> then close the file, and reopen it to read the binary (bytes in this
> >> case) but I have no idea how to step across the header again when I
> >> reopen it and try to read the file as binary?- Hide quoted text -
>
> >> - Show quoted text -
>
> >One possible hint: =A0If the header size is fixed (or you otherwise
know
> >its size), just read it into a dummy/unused variable and discard it
> >(define a second header (or reuse the old variable if you're done with
> >it or have saved it off) and include it on the "binary" read (assuming
> >it represents the proper size).
>
> =A0 But be aware that if the original header data were
> somehow written as formatted, there may be a crlf to skip
> as well.
> =A0 Your system may have a hex dump utility - in which
> case you could look and see - the utility will often
> show simultaneous =A0hex and ascii decoding.
On the other hand, why just not read them both using "binary" I/O,
especially if it is of known/fixed size.
>
> Chris- Hide quoted text -
>
> - Show quoted text -


|