Solved

reading binary file(fortran code converts)

Posted on 2000-04-02
1
369 Views
Last Modified: 2012-05-04
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
Comment
Question by:worker018
1 Comment
 
LVL 1

Accepted Solution

by:
the_bikeman earned 50 total points
ID: 2679036
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now