| 查看: 828 | 回复: 2 | ||
csu_cheng木虫 (正式写手)
|
[求助]
很简单的一段代码,求助fortran大神
|
|
程序很简单,首先得到当前日期,然后与老文件pmain1-save.f90中的‘linkdate=’后面的日期位置,并在pmain.f90新文件中更改‘linkdate=’为当前日期。 无论pmain1-save.f90和pmain.f90中写的是什么,都会出现段错误信息。编译环境win10 64位, gcc 5.1。 源代码如下: program linkocdate ! extract current date and inserts it in the source code of the main program character date*8,mdate*12,line*60 call date_and_time(date) mdate="'"//date(1:4)//'-'//date(5:6)//'-'//date(7:8)//"'" !write(*,*) mdate open(21,file='pmain1-save.F90',access='sequential',status='old') open(22,file='pmain1.F90',access='sequential',status='unknown') 100 continue read(21,110,end=200)line k=index(line,'linkdate=') !find the location of 'linkdate=' in 21 if(k.gt.0) then line(k+9: )=mdate !write(*,*)line(1:40) endif write(22,110)line(1:len_trim(line)) 110 format(a) goto 100 200 continue close(21) close(22) stop end program linkocdate |
» 猜你喜欢
应该是93bebmhtak前后十一个字符比较关键
已经有19人回复
2026国自然放榜时间
已经有9人回复
这样的filecode谁见过
已经有22人回复
据悉今年马上要出结果了
已经有6人回复
综述论文作为代表作会不会影响评审专家的印象分?
已经有7人回复
面上项目filecode邪修
已经有7人回复
关于代码变化问题,想知道的进来
已经有22人回复
filecode与中标关系的预测
已经有5人回复
fileCode有新解读?
已经有18人回复
关于filecode,很负责任的告诉大家
已经有7人回复
wxws.2008
木虫 (正式写手)
- 应助: 5 (幼儿园)
- 金币: 5015.5
- 散金: 256
- 红花: 9
- 帖子: 354
- 在线: 147.9小时
- 虫号: 639701
- 注册: 2008-10-29
- 性别: GG
- 专业: 荒漠化与水土保持
2楼2015-12-01 18:40:32
csu_cheng
木虫 (正式写手)
- 应助: 1 (幼儿园)
- 金币: 3039.7
- 散金: 23
- 红花: 1
- 帖子: 528
- 在线: 194.2小时
- 虫号: 923006
- 注册: 2009-12-08
- 专业: 金属材料的合金相、相变及
3楼2015-12-02 20:24:44










回复此楼
20