- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi folks
I have an old Fortran file that prints to an output filewith the beautiful formatting precision and line-by-line tender loving care that only having to code in the old days and the old ways could have produced.
While it's very pretty to look at, with a dash of post-modern penchant for the macabre, Iwant it to stop. I now have the code writing the same results in a much more efficient and Stu-friendly format so I no longer need this printout. However, I or others may in the future, since the code does a lot I'm not using right now, so I don't want to simply comment out every single line containing WRITE(10,... - for one because this seems crass, and for two because there are many such lines already commented out by previous editors of the code in their efforts to perfect the formatting for themselves. It would be downright malicious to force whoever uses the code next to have to back-calculate which writes to uncomment for a legible printout.
So, my long-winded question: is there a way to get Fortran to simply disregard all write statements to a particular unit, or to somehow dupe it into not doing so?
Much 'bliged
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[fortran]OPEN(10, FILE='NUL') WRITE(10, "(A)") 'He suggests you connect the file to the NUL device' WRITE (10,"(A)") 'See http://en.wikipedia.org/wiki//dev/null for more information' CLOSE(10)[/fortran]
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you can attach the until to 'NUL', which will result in the output being discarded. the writes will still be executed, but you won't have the output file.
David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi David
I'm sorry, but I'm not quite following you. Would you mind elaborating?
I did some digging and I found no mention of 'NUL' associated with WRITE statements anywhere, so perhaps you're implying using a pointer somehow? I have never yet used a pointer in Fortran to be totally honest (I am relatively new to the FOR-game, and largely trapped in 1977 if you get my drift) so this allusion might be going over my head...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[fortran]OPEN(10, FILE='NUL') WRITE(10, "(A)") 'He suggests you connect the file to the NUL device' WRITE (10,"(A)") 'See http://en.wikipedia.org/wiki//dev/null for more information' CLOSE(10)[/fortran]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
![](/skins/images/045A6C88D0527A93E76B179D7F5E2AFE/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page