- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ¶ms [...] / , but it still chokes at reading the "/" in the string.
Thanks,
Ángel de Vicente
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page