How to read a binary file using Fortran and save to a text file? -


i have binary file following information:

ifile.dat big_endian sequential, nx=530, ny= 427, t=1, 4 variables 

i read fortran program , write text file. trial f90 program is:

bin_read.f90:

  integer,parameter :: nx=530, ny=427   real :: v1(nx,ny),v2(nx,ny),v3(nx,ny),v4(nx,ny)    open(10, file= 'ifile.dat', form = 'unformatted', &  &access='sequential',convert='big_endian')   open(11, file= 'ofile.txt', form = 'formatted', &  &status='unknown')    j = 1, ny     = 1, nx       read(10,*)v1(i,j),v2(i,j),v3(i,j),v4(i,j)       write(11,1)v1(i,j),v2(i,j),v3(i,j),v4(i,j) 1     format(4(1x,f8.3))     enddo   enddo    stop   end 

when execute after compilation, getting following message:

at line 11 of file bin_read.f90 (unit = 10, file = 'ifile.dat') fortran runtime error: format present unformatted data transfer 


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -