[Fortran] 纯文本查看 复制代码
program main
implicit none
integer charnum
character,allocatable::smi(:)
!!character(len=30)::smi
character(len=1)sinelem
character(len=2)douelem
charnum=30
allocate(smi(charnum))
smi=''
sinelem="A"
douelem="BB"
write(smi(1:1),"(A1)")sinelem
write(*,*)smi
write(smi(2:3),"(A2)")douelem
write(*,*)smi
end
[Fortran] 纯文本查看 复制代码
program main
implicit none
integer charnum
!!character,allocatable::smi(:)
character(len=30)::smi
character(len=1)sinelem
character(len=2)douelem
charnum=30
!!allocate(smi(charnum))
smi=''
sinelem="A"
douelem="BB"
write(smi(1:1),"(A1)")sinelem
write(*,*)smi
write(smi(2:3),"(A2)")douelem
write(*,*)smi
end