Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28459 Discussions

Including character "/" in a NAMELIST

de_Vicente__Angel
210 Views

Hello,

my program uses namelists to read input parameters and it behaves nicely except if I want to include a "/" in a string. An example that works is a var=value line like this, that sets the name of a file for I/O.

atmoname = "atmosphere_RTI.h5"

But if I want to include a path for the file:

atmoname = "sim1/atmosphere_RTI.h5"

Then the namelist parsing stops at that "/" and the namelist reading is incorrect.

I tried by starting the namelist with $params [...] $end instead of the standard &params  [...] /  , but it still chokes at reading the "/" in the string.

Thanks,

Ángel de Vicente

 

0 Kudos
1 Reply
de_Vicente__Angel
212 Views

Problem solved. It turns out that the problem was not in the reading of the "/" in the string in the original namelist. This is a parallel program, so I read the namelist  in one of the processors from the file, then to avoid some problems I had in the past with comments I first write the NAMELIST to an intermediate file (that gets rid of all comments, etc.), then I read this intermediate file again and as a string buffer send via MPI to all the other processors. The problem was in this intermediate file and the DELIM option at file opening. Since I didn't set it, the intermediate file didn't enclose the file path in quotes and the error happened. Setting the DELIM="QUOTE", all is in order.

Cheers,

Ángel

0 Kudos
Reply