- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I am a new user of FORTRAN language. I write a program for index calculation. My program contains with 10 subroutines. First 9 subroutines produced an output file. I want to use first output file as an input file for the last one subroutine in same program.
How can I write this input and read command.
please, support me.
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The simplest way to achieve this is:
- Write all the output to the output file
- Close the file when you are done (so when the ninth subroutine as finished)
- Then open it again, now you can read it from the start
Something like:
real :: x open( 10, file = 'result.out' ) write( 10, * ) cos(1.0) close( 10 ) open( 10, file = 'result.out' ) read( 10, * ) x close( 10 ) write( *, * ) 'The number that was produced is ', x
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The simplest way to achieve this is:
- Write all the output to the output file
- Close the file when you are done (so when the ninth subroutine as finished)
- Then open it again, now you can read it from the start
Something like:
real :: x open( 10, file = 'result.out' ) write( 10, * ) cos(1.0) close( 10 ) open( 10, file = 'result.out' ) read( 10, * ) x close( 10 ) write( *, * ) 'The number that was produced is ', x
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many thanks @Arjen Markus. I have been solved my problems as per following your guidelines.
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