How to read a binary file with variable length record 
Author Message
 How to read a binary file with variable length record

Hello,

I have some binary files created with C++ program. Is there any way to
access them with fortran 90/95.  The advance="no" can not be used with
unformatted file. Any idea? Thanks!

Long



Sat, 11 Jun 2005 02:27:29 GMT  
 How to read a binary file with variable length record

Quote:

>I have some binary files created with C++ program. Is there any way to
>access them with Fortran 90/95.  The advance="no" can not be used with
>unformatted file. Any idea? Thanks!

What compiler are you using?

See if the OPEN statement has a FORM= keyword "binary" or "sytem" or
"transparent".  That would be what you need.

If not, you can usually read files byte by byte (or word by word) with
a combination of form='unformatted', access='direct', and recl= some
minimum value.

Fortran 2K will have this built in, using keyword "stream".  IMHO, it
really would have been clearer if the committee had taken my
suggestion and made it "threepwood".  But the capability will be
there.

Ken Plotkin



Sat, 11 Jun 2005 07:39:28 GMT  
 How to read a binary file with variable length record
Thanks for the info! I am using Lahey LF95 compiler. After reading your
reply, I was able to use < Form="binary",access="transparent",recl=1 > to
read my binary file. But I did run into a weird problem with the file size;
if you are interested, you can take a look at my other post " ???file size
question!" in this forum. Thanks again for your help!

Long


Quote:

> >I have some binary files created with C++ program. Is there any way to
> >access them with Fortran 90/95.  The advance="no" can not be used with
> >unformatted file. Any idea? Thanks!

> What compiler are you using?

> See if the OPEN statement has a FORM= keyword "binary" or "sytem" or
> "transparent".  That would be what you need.

> If not, you can usually read files byte by byte (or word by word) with
> a combination of form='unformatted', access='direct', and recl= some
> minimum value.

> Fortran 2K will have this built in, using keyword "stream".  IMHO, it
> really would have been clearer if the committee had taken my
> suggestion and made it "threepwood".  But the capability will be
> there.

> Ken Plotkin



Sat, 11 Jun 2005 12:59:18 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Reading variable-length records from a file

2. Attempting to read variable length records as raw data

3. Variable length records (How to define/read)

4. Reading variable length records...

5. Getting true length of a variable length record - IBM Mainframe

6. Finding Variable-Length Record Length

7. processing variable length records in text file

8. Import dos file variable record length

9. How to access files with variable length records?

10. How to access files with variable length records?

11. Sorting a file with variable length records.

12. Accessing variable-length records files in C-ISAM standard

 

 
Powered by phpBB® Forum Software