Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Fortran > Re: Read a head...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 12 of 13 Topic 8543 of 8908
Post > Topic >>

Re: Read a header and then a binary file?

by GaryScott <garylscott@[EMAIL PROTECTED] > Jul 23, 2008 at 09:00 AM

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 -
 




 13 Posts in Topic:
Read a header and then a binary file?
badger <mdekauwe@[EMAI  2008-07-23 03:40:49 
RE: Read a header and then a binary file?
meek@[EMAIL PROTECTED]   2008-07-23 07:08:14 
Re: Read a header and then a binary file?
badger <mdekauwe@[EMAI  2008-07-23 06:44:33 
Re: Read a header and then a binary file?
GaryScott <garylscott@  2008-07-23 07:37:33 
RE: Read a header and then a binary file?
meek@[EMAIL PROTECTED]   2008-07-23 09:17:28 
Re: Read a header and then a binary file?
Rich Townsend <rhdt@[E  2008-07-23 15:12:36 
Re: Read a header and then a binary file?
nospam@[EMAIL PROTECTED]   2008-07-23 15:27:51 
Re: Read a header and then a binary file?
Rich Townsend <rhdt@[E  2008-07-23 22:08:42 
Re: Read a header and then a binary file?
nospam@[EMAIL PROTECTED]   2008-07-23 23:23:20 
Re: Read a header and then a binary file?
glen herrmannsfeldt <g  2008-07-24 05:26:38 
Re: Read a header and then a binary file?
glen herrmannsfeldt <g  2008-07-24 11:43:44 
Re: Read a header and then a binary file?
GaryScott <garylscott@  2008-07-23 09:00:23 
Re: Read a header and then a binary file?
GaryScott <garylscott@  2008-07-23 15:14:19 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Nov 19 7:36:13 CST 2008.