Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Allocatable character strings in namelists?

$
0
0

Assume I have a text file called 'text.txt' which contains:

&A
S = 'Hi!'
/

The following code produces different output depending on which line is commented out for the definition of S. I thought allocatable characters were accepted in namelist groups?

PROGRAM P
IMPLICIT NONE
!CHARACTER(LEN=50) :: S
CHARACTER(LEN=:),ALLOCATABLE :: S
NAMELIST /A/ S
OPEN(UNIT=10,FILE='test.txt')
READ(10,NML=A)
WRITE(*,*) S
END PROGRAM P

 


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>