| 查看: 906 | 回复: 5 | ||||
| 当前主题已经存档。 | ||||
| 当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖 | ||||
maomao1210金虫 (正式写手)
|
[交流]
【求助】getarg 的用法
|
|||
|
求高手指点Fortran 中Getarg的用法。 看程序的时候已经见到Getarg(),但始终没弄明白,求高手指点。。。。 [ Last edited by sunxiao on 2009-4-30 at 11:30 ] |
» 收录本帖的淘帖专辑推荐
fortran相关 |
» 猜你喜欢
全日制(定向)博士
已经有5人回复
假如你的研究生提出不合理要求
已经有10人回复
萌生出自己或许不适合搞科研的想法,现在跑or等等看?
已经有4人回复
Materials Today Chemistry审稿周期
已经有4人回复
参与限项
已经有3人回复
实验室接单子
已经有4人回复
对氯苯硼酸纯化
已经有3人回复
求助:我三月中下旬出站,青基依托单位怎么办?
已经有12人回复
所感
已经有4人回复
要不要辞职读博?
已经有7人回复
maomao1210
金虫 (正式写手)
- 程序强帖: 5
- 应助: 2 (幼儿园)
- 金币: 1431.3
- 散金: 242
- 红花: 16
- 沙发: 1
- 帖子: 991
- 在线: 441.5小时
- 虫号: 253215
- 注册: 2006-05-20
- 性别: MM
- 专业: 考古理论
3楼2009-03-23 15:49:32
snoopyzhao
至尊木虫 (职业作家)
- 程序强帖: 16
- 应助: 157 (高中生)
- 贵宾: 0.02
- 金币: 18844.7
- 红花: 29
- 帖子: 3803
- 在线: 1422.4小时
- 虫号: 183750
- 注册: 2006-02-13
- 专业: 污染生态化学
★ ★
sunxiao(金币+2,VIP+0):谢谢参与,欢迎常来交流 3-23 23:09
sunxiao(金币+2,VIP+0):谢谢参与,欢迎常来交流 3-23 23:09
|
g77 的说明文档中如是说: 8.11.9.118 GetArg Intrinsic CALL GetArg(Pos, Value) Pos: INTEGER not wider than the default kind; scalar; INTENT(IN). Value: CHARACTER; scalar; INTENT(OUT). Intrinsic groups: unix. Description: Sets Value to the Pos-th command-line argument (or to all blanks if there are fewer than Value command-line arguments); CALL GETARG(0, value) sets value to the name of the program (on systems that support this feature). See Section 8.11.9.133 [IArgC Intrinsic], page 145, for information on how to get the number of arguments. 相关的 IArgC() 如下: 8.11.9.133 IArgC Intrinsic IArgC() IArgC: INTEGER(KIND=1) function. Intrinsic groups: unix. Description: Returns the number of command-line arguments. This count does not include the specification of the program name itself. |
2楼2009-03-23 14:11:55
maomao1210
金虫 (正式写手)
- 程序强帖: 5
- 应助: 2 (幼儿园)
- 金币: 1431.3
- 散金: 242
- 红花: 16
- 沙发: 1
- 帖子: 991
- 在线: 441.5小时
- 虫号: 253215
- 注册: 2006-05-20
- 性别: MM
- 专业: 考古理论
4楼2009-03-25 09:27:39
老虎大王
木虫 (著名写手)
- 应助: 26 (小学生)
- 贵宾: 0.17
- 金币: 4774.1
- 散金: 8
- 红花: 42
- 帖子: 1361
- 在线: 215.2小时
- 虫号: 659094
- 注册: 2008-11-21
- 专业: 金属结构材料
★ ★ ★ ★ ★
maomao1210(金币+5,VIP+0):Thanks a lot,.. 3-28 17:58
maomao1210(金币+5,VIP+0):Thanks a lot,.. 3-28 17:58
|
这个是用来返回你输入的命令行参数的。 call getarg(n,buffer) 其中n是命令序号, buffer是相应的命令行参数。运行程序本身的命令是0号,跟在它后面的参数是1,2。。。号。 比如,你写这样一个小程序: character*80 buff call getarg(0,buff) write(*,*) buff call getarg(1, buff) write(*,*) buff call getarg(2, buff ) write (*,*) buff end 然后编译它,比如把这个可执行程序命名为mypro,然后键入命令如下 Linux系统,键入 ./mypro ar1 ar2 可以看到结果是 ./mypro ar1 ar2 Windows下,则键入 mypro ar1 ar2 可看到结果是 mypro ar1 ar2 可见,用命令行方式,程序执行命令本身是第0个参数,后面跟的第1,2。。个参量则可以用相应的getarg来获得。利用这个getarg,你可以在外部输入命令时控制程序中的一些东西。 |
5楼2009-03-27 19:29:53












回复此楼