Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
11 Views

Including character "/" in a NAMELIST

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
Highlighted
11 Views

Problem solved. It turns out

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