If the input of the following working example ist - for example - "ach_40", the output is "ach_40.DOC?" and "ach_40.IMG". Where is the "?" coming from?
The code is:
program test
character*8 filin
character*12 dummy,file1,file2
character*4 :: img = '.IMG', doc='.DOC'
integer*4 ls1, ls2, i
write(*,*) ' File (without extension): '
read(*,'(a8)') filin
c first file
dummy=filin // doc
ls1 = len_trim(dummy)
ls2=0
do i = 1,ls1
if(dummy(i:i).ne.' ') then
ls2=ls2+1
file1(ls2:ls2) = dummy(i:i)
endif
enddo
c second file
dummy=filin // img
ls1 = len_trim(dummy)
ls2=0
do i = 1,ls1
if(dummy(i:i).ne.' ') then
ls2=ls2+1
file2(ls2:ls2) = dummy(i:i)
endif
enddo
write(*,*) file1
write(*,*) file2
stop
end
Thanks a lot for your hint!!
file1to be?". - IanH