[Fortran] Dump Data To File

 1 PROGRAM MAIN
 2   I = 1
 3   J = 2
 4   K = 11
 5   Call DumpData(I,J,K)
 6 END  PROGRAM MAIN
 7 
 8 SubRoutine DumpData(I,J,K)
 9     OPEN(    UNIT   =   112                     &
10             ,FILE   =   'DumpErr.dat'           &       
11             ,FORM   = 'FORMATTED'               &
12             ,STATUS = 'REPLACE'                 &
13             ,ACCESS = 'SEQUENTIAL'              &
14     )
15     
16     WRITE(112,*),"I = ",I
17     WRITE(112,*),"J = ",J
18     WRITE(112,*),"K = ",K+1
19     
20     Close(112)
21     RETURN
22 End SubRoutine DumpData
main.f90

 

大概就是文件操作~

posted @ 2014-12-09 10:56  Alimy  阅读(474)  评论(2编辑  收藏  举报