- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would like to read real values from a text file, not knowing in advance their format (width and position of the decimal point).
E.g., a user specifies
0.915
1000
12.300
and I would like to read these values into real variables. Is there any way of opening and reading the text file so that I would not have to force the user to specify values in a certain format?
E.g., a user specifies
0.915
1000
12.300
and I would like to read these values into real variables. Is there any way of opening and reading the text file so that I would not have to force the user to specify values in a certain format?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is Murphy's law - I think I found a solution right after posting my questions. It seems that
[cpp]OPEN ( unit, FILE='...', FORM='FORMATTED', ACCESS='SEQUENTIAL', ACTION='READ' ) READ ( unit, * ) value[/cpp]could do the job; I just hope there is nothing wrong about it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For your example, list-directed is fine. F12.0 would work too.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page