image
Physics Forums Logo
image
image
* Register * Upgrade Blogs Library Staff Rules Mark Forums Read
image
image   image
image

image Read multiple binary files to ascii Share It Thread Tools Search this Thread image
Old Nov7-09, 06:28 AM                  #1
zar

zar is Offline:
Posts: 1
Read multiple binary files to ascii

Dear all,

I'm sorry for this primary issue. I have a Fortran program that reads a single binary file and writes a single ascii file. As I have many files I would like the program to read and write to ascii those multiple binary files once.
Example files: c_002.bip_c1.bin, c_005.bip_c1.bin, c_006.bip_c1.bin,c_008.bip_c1.bin,c_010.bip_c1.bin ,c_013.bip_c1.bin etc. Only the numbers after the "c_" change from one file to the other.Below is the program:
----------
implicit none
integer lat, lon, irec,x,y
real*4 bmap(180,90)
parameter(irec=180*90*4)
open(21,file=
& 'c_015.bip_c1.bin',
& access='direct',
& form='unformatted',
& recl=irec,status='old',err=999)
read(21,rec=1,err=999)
& ((bmap(lon,lat),lon=1,180),lat=1,90)
close(21)
open(31,file=

& 'c_015.bip_c1.txt',
& form='formatted')
do 123 y=1,90
write(31,30) (bmap(x,y),x=1,180)
30 Format(180F12.6)
123 continue

999 continue

stop
End
-------------

Hope somebody would help
Thanks
Zar
  Reply With Quote
image image
Reply

Tags
multiple files
Thread Tools


Similar Threads for: Read multiple binary files to ascii
Thread Thread Starter Forum Replies Last Post
How to Import Igor Pro Binary Wave files into Mathematica? llybt Math & Science Software 0 Oct26-09 10:03 PM
FORTRAN, open several files and read it vikincarioca Programming & Comp Sci 15 Oct7-09 05:32 PM
Fortran 90 (need to read in binary data files into arrays) sparkstermaes Math & Science Software 1 Feb5-09 11:20 AM
Python: open dat-files, read data MaxManus Engineering, Comp Sci, & Technology 2 Oct20-08 03:18 AM
Yet another c++ question - reading multiple files Moe Computing & Technology 5 Jun25-04 05:14 PM

Powered by vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd. © 2009 Physics Forums
Sciam | physorgPhysorg.com Science News Partner
image
image   image