| 查看: 728 | 回复: 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 |
» 猜你喜欢
材料考研调剂
已经有3人回复
材料调剂
已经有12人回复
英一数一408,总分284,二战真诚求调剂
已经有14人回复
085410 一志愿211 22408分数359求调剂
已经有4人回复
271求调剂
已经有19人回复
385分 生物学(071000)求调剂
已经有3人回复
一志愿安徽大学计算机科学与技术学硕,331分求调剂
已经有3人回复
318求调剂,计算材料方向
已经有8人回复
291求调剂
已经有25人回复
一志愿北京科技大学085601材料工程英一数二初试总分335求调剂
已经有6人回复
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
- 在线: 193.9小时
- 虫号: 923006
- 注册: 2009-12-08
- 专业: 金属材料的合金相、相变及
3楼2015-12-02 20:24:44














回复此楼