是否有fortran二进制文件打开选项的替代选项;RECORDTYPE=stream";?

是否有fortran二进制文件打开选项的替代选项;RECORDTYPE=stream";?,fortran,Fortran,我有一个fortran程序,我必须打开一个二进制输出文件。通常有人会指定 RECL=num 但是,对于我的特殊情况,使用该选项打开的文件不起作用。有效的是 RECORDTYPE=stream 我通常不接受第二个选项的gfortran。使用RECL选项,程序工作,但数据不可用。英特尔编译器可以。英特尔不再提供免费的编译器,我失去了我拥有的免费英特尔编译器 如果有人建议我用gfortran写一个流,或者有人可以备份他们的编译器文件夹,把它放在googledrive上,并给我链接(希望这不是滥用)

我有一个fortran程序,我必须打开一个二进制输出文件。通常有人会指定

RECL=num
但是,对于我的特殊情况,使用该选项打开的文件不起作用。有效的是

RECORDTYPE=stream
我通常不接受第二个选项的gfortran。使用RECL选项,程序工作,但数据不可用。英特尔编译器可以。英特尔不再提供免费的编译器,我失去了我拥有的免费英特尔编译器

如果有人建议我用gfortran写一个流,或者有人可以备份他们的编译器文件夹,把它放在googledrive上,并给我链接(希望这不是滥用)。 我在Ubuntu 18.04上工作

我在下面粘贴了一个我使用的示例程序和要写入二进制的数据

     Program stndat
 implicit none

 integer                     :: iflag=0,itime=0
 integer                     :: nlev,ihrold,nflag,icount
 integer                     :: ihr   !,iwx,delta,cld,vis
 integer,dimension(1:3)      :: today,now

 Real                        :: lat,lon,iu,iv,itemp,idp,ipress

 CHARACTER(len=3)            :: stnid
 character(len=8)            :: date
 character(len=10)           :: time
 character(len=5)            :: zone
 character(len=8)            :: year,inst*10,hour*2
!
 integer,dimension(1:8)      :: values

 ! using keyword arguments
 call date_and_time(date,time,zone,values)
!
 open(1,file='tmp.txt')
 write(1,'(1x,a8,2x,a10)') date,time
     Program stndat
 implicit none

 integer                     :: iflag=0,itime=0
 integer                     :: nlev,ihrold,nflag,icount
 integer                     :: ihr   !,iwx,delta,cld,vis
 integer,dimension(1:3)      :: today,now

 Real                        :: lat,lon,iu,iv,itemp,idp,ipress

 CHARACTER(len=3)            :: stnid
 character(len=8)            :: date
 character(len=10)           :: time
 character(len=5)            :: zone
 character(len=8)            :: year,inst*10,hour*2
!
 integer,dimension(1:8)      :: values

 ! using keyword arguments
 call date_and_time(date,time,zone,values)
!
 open(1,file='tmp.txt')
 write(1,'(1x,a8,2x,a10)') date,time
 rewind(1)
 read(1,'(1x,a8,2x,a10)') year,inst
 close(1,status='delete')

 iflag=0
 itime=0
 icount=1

 hour = time(:2)
 hour = '09'
!    Open up I/O Files
Open(unit=11,file='../../Output/synop4grads.txt',status='old')
Open(unit=12,file='../../Output/Obs_out.bin',form='unformatted',recordtype='stream',status='unknown')
10   continue
 !   Read in the line of code


 read(11,'(1x,a3,2x,f5.2,2x,f6.2,2x,i2,8(2x,f5.1))',END=40) stnid,lon,lat,ihr,iu,iv,itemp,idp,ipress
   IF (iflag.EQ.0) THEN
   iflag=1
   ihrold=ihr
ENDIF
 !

     !       Check to see if this is an old time group. If so, write a terminator
         IF (ihrold.NE.ihr) THEN
            nlev=0
            write(12)stnid,lat,lon,ihr,nlev,nflag
         ENDIF

     !       Now make ihrold equal to the current ihr

         ihrold=ihr
    !
 !       Now we can go ahead and write the report
 !       First, define some variables to be used in the header

     itime=0.
     nlev=1
     nflag=1
         write(12) stnid,lat,lon,ihr,nlev,nflag
 !
 !       read in the following: itemp,idp,ipress,iu,iv,iwx,ic,icl
         write(12) iu,iv,itemp,idp,ipress
 !       When its done writing one report, instruct the program
 !       to read-in the next line
         go to 10
 !
 !       When there are no more lines to read-in, the program
 !       goes to 40
  40      continue
         nlev=0
 !
         write(12)stnid,lat,lon,ihr,nlev,nflag
      close(11)
      close(12)
    end
数据呢

   403  29.08   -9.80  01   -0.5   -3.0   24.0   16.5  496.0
   441  24.43  -11.75  01  -99.0  -99.0   18.5   16.8  533.0
   461  28.85  -11.10  01   -1.4   -9.9   26.0   17.7  485.0
   475  31.12  -10.21  01   -1.0   -9.9   24.4   14.0  509.0
   476  31.25  -10.10  01   -0.7   -6.0   24.0   14.5  -99.0
   477  31.43  -11.90  01   -1.7  -49.0   -9.9    0.0  500.0

这有帮助吗?这很有趣,非常感谢。我会在尝试时给出反馈。再次非常感谢@Roadowl你给我的链接解决了所有问题。我不再需要我一直渴望的另一个编译器了。GNU fortran足以完成这项工作。我很感激你的时间。很高兴它对我有帮助,而且它确实如此!