将 Fortran 中带有 Err 说明符的 OPEN 函数转换为 PHP 中的 fopen 函数
我需要在 php 中找到 fortran 行的等效表达式: fortran 代码:
10 OPEN(UNIT=10,FILE='TEST.OUT',STATUS='NEW', ERR=9001)
GOTO 11
9001 OPEN(UNIT=10,FILE='TEST.OUT')
CLOSE(10,STATUS='DELETE')
OPEN(UNIT=2,FILE='fort2')
CLOSE(2,STATUS='DELETE')
GOTO 10
11 OPEN(UNIT=7,FILE='TEST.SUM',STATUS='NEW')
我想将此代码转换为 php 代码。我想使用 fopen 函数,但我不知道如何让它跳转到第 9001 行以首先删除旧文件(如果有任何旧文件)。 非常感谢您的帮助。
I need to find an equivalent expression for a fortran line in php:
fortran code:
10 OPEN(UNIT=10,FILE='TEST.OUT',STATUS='NEW', ERR=9001)
GOTO 11
9001 OPEN(UNIT=10,FILE='TEST.OUT')
CLOSE(10,STATUS='DELETE')
OPEN(UNIT=2,FILE='fort2')
CLOSE(2,STATUS='DELETE')
GOTO 10
11 OPEN(UNIT=7,FILE='TEST.SUM',STATUS='NEW')
I would like to convert this code into a php code. I would like to use fopen function but I do not know how to aks it to jump to line 9001 to delete old files fisrt if there is any old file.
Really appreciate your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道 Fortran 代码到底在做什么,但听起来你想要这样:
注意
'w'
模式的描述:否则可能:
不过,您应该小心不要陷入无限循环。
您也可以自己进行这些检查:
I don't know what that Fortran code is doing exactly, but it sounds like you want this:
Note the description of the
'w'
mode:Otherwise possibly:
You should be careful not to get into an infinite loop there though.
You can also do those checks yourself: