• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 388
  • Last Modified:

reading binary file(fortran code converts)

Hello..  
I have a problem in converting fortran code to C code
The code is like this
==========================================

       open(15,file=grname,form='unformatted')

       do 10 i=1,im
       read(15) x(i)      
 10       continue
          :
          :
===========================================

I have mach experience to handling text type files but
I don't know haw I can read binary file(unformated file).
Would you please help me?
0
worker018
Asked:
worker018
1 Solution
 
the_bikemanCommented:
In C, to read a binary file you must append "b" to the mode string.  

Eg.  FILE *fp;
       fp = fopen("myfile", "rb");  /*will open myfile for reading in binary                                                     mode*/

the_bikeman
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now