ibeg = 1
do i = 1, nLines !nLines:行数
read(12, "(a128)") cLine
read(cLine(1: 1), *) n
read(cline(3: len_trim(cLine)-1), *) Aarray(ibeg : ibeg + n - 1)
ibeg = ibeg + n
end do
li913 发表于 2021-10-21 14:30
这样已经很好了,没有改进的余地。另一种就是修改输入文件,把大括号替换为空格。
...
do i = 1, nLines
read(12, "(i1,1x,a128)") n , cLine
read(cline(:len_trim(cLine)-1),*) Aarray(ibeg : ibeg + n - 1)
ibeg = ibeg + n
end do
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |