- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was just reading jm-nichols post on some "old code" and unformatted reads and noted a similar problem I was having with somewhat similar code:
REAL TIME CHARACTER (LEN = 8) NAME INTEGER IX, IY, IZ, IDX, ITYPE ! INPUT_CODE is an input parameter, the UNIT number READ(INPUT_CODE,*) NAME, TIME, IX, IY, IZ, IDX, ITYPE
I was getting a cold hard crash when the input stream had a forward slash in the name. Are the admissible characters you can read into a character string with an unformatted READ documented somewhere? Might this behavior have something to do with my compiler settings?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
List directed technically is formatted. List directed read into a character variable is notoriously unreliable, although quote marks may help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First, some terminology. This is a list-directed formatted read, not unformatted. The Fortran standard indicates what is valid input for list-directed. though Intel Fortran is a bit more lenient. In the case you mention, read of an undelimited character value stops when a "value separator) is seen. The value separators are slash, comma and blank (or tab in our implementation). Slash causes input termination, so that is probably why your reads fail.
You can enclose the name string in quotes in the input to get around this, if the name has separators in it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you. Yes, unfortunately I misnamed the topic. What I was trying to point out was that there was not an explicit FMT given with the READ. Thank you for the list of "value separators" and the workaround. I will inform our UI team of the limitation. I suppose then one other limitation might be unmatched quote marks?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unmatched quotes would be a problem, yes.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page