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

reading binary file(fortran code converts)

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


       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?
1 Solution
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*/

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get Certified for a Job in Cybersecurity

Want an exciting career in an emerging field? Earn your MS in Cybersecurity and get certified in ethical hacking or computer forensic investigation. WGU’s MSCSIA degree program was designed to meet the most recent U.S. Department of Homeland Security (DHS) and NSA guidelines.  

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