I am trying to use trim
/adjustl
for the following code. It seems that I'm getting either X_eq_ 10.0.dat
or X_eq_10.0 .dat
as the output file's name where I'm expecting it to be X_eq_10.0.dat
(no blank space). Any remedy?
Program Test
double precision:: X
character (len=10) :: tag
character (len=100) :: outfile
X=10.0
write(tag,'(f10.1)') X
print*,'tag=',tag
outfile='X_eq_'//trim(tag)//'.dat'
print*,'Output file: ',outfile
outfile='X_eq_'//trim(tag)//trim('.dat')
print*,'Output file: ',outfile
outfile='X_eq_'//adjustl(trim(tag))//adjustl(trim('.dat'))
print*,'Output file: ',outfile
End Program Test
I have used gfortran
as the compiler.