|
现在我要读取循环predict文件,用时间文件date作为读文件的路径一部分,并用时间文件控制要读哪个文件,我调用下面的程序能输出outputfile1(j),outputfile2(j)实现吗?代码如下: 谢谢老师!
[Fortran] 纯文本查看 复制代码 01 | subroutine timefileprepare ( Began_time , finish_time , deltminute , outputfile 1 , outputfile 2 , sizeoffile , totaltime ) |
02 | integer Began_time , finish_time , deltminute , totaltime |
03 | integer datelength , sizeoffile |
04 | integer minutestep , hourstep , tempint |
05 | character ( 90 ) date 1 char , date 2 char , timechar , temp_char |
06 | character outputfile 1 ( 4300 ) , outputfile 2 ( 4300 ) |
07 | integer dateofile ( 25000 ) |
08 | integer date 1 , date 2 , time |
11 | open ( 11 , file = "date.txt" ) |
13 | do while ( .not. eof ( 11 ) ) |
15 | read ( 11 , * ) dateofile ( i ) |
27 | if ( ( ( dateofile ( i ) ) .GE. ( Began_time ) ) .and. ( ( dateofile ( i ) ) .LE. ( finish_time ) ) ) then |
30 | date 1 = int ( dateofile ( i ) / 10000 ) +2 * 10 * * 7 |
31 | date 2 = int ( dateofile ( i ) / 10000 ) +2 * 10 * * 7 +2 * 10 * * 9 |
32 | time = dateofile ( i ) - int ( dateofile ( i ) / 10000 ) * 10000 |
34 | write ( temp_char , "(I4)" ) time |
35 | timechar = "0" / / trim ( temp_char ) |
37 | write ( timechar , "(I4)" ) time |
38 | write ( date 1 char , "(I8)" ) date 1 |
39 | write ( date 2 char , "(I10)" ) date 2 |
41 | outputfile 1 ( j ) = trim ( date 1 char ) / / "_" / / trim ( timechar ( 2 : 5 ) ) |
42 | outputfile 2 ( j ) = trim ( date 2 char ) / / "_" / / trim ( timechar ( 2 : 5 ) ) |
|
-
1.png
(54.24 KB, 下载次数: 350)
date.txt文件
-
8.png
(171.83 KB, 下载次数: 350)
要读取的文件
|