我创建了一个字符串数组,并希望从数组值中分配输出。出现的问题是信息未被复制。
Block
Character (Len=65), Allocatable :: typ(:)
fa = "ftyp.org"
Open (newunit=u, file=fa, form=human, action="read", &
status="old")
Allocate (typ(nl))
typ = ""
Do i = 1, nl
Read (u,"(a)") typ(i)
End Do
Close (u)
a = Trim (typ(1))
Write (*,*) "typ(1): ", Trim (typ(1))
Write (*,*) "a: ", Trim (a)
输出如下
typ(1): test_ftyp.org: ASCII text
a:
答案 0 :(得分:0)
我已经确定了问题所在。它发生在我用可选参数调用子例程的方式中。变量
a
是一个可选参数。我在没有可选参数的情况下调用了例程,这意味着a
默认为空字符串。