- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am trying to output the data from one of my simulations to note pad and to do so i do the following:
1) Create a blank text file in note pad (example: 'inventx')
2) Define the open statement: OPEN (UNIT=10, FILE='inventx.txt', STATUS='REPLACE')
3) Specify the OPEN statement within the WRITE statement (example: WRITE(10, 100) k, v_avg)
The compiler will allow me to build the program no problems but the data is not written to the specified file when the system is run. Can anyone tell me what i am doing wrong?
I am trying to output the data from one of my simulations to note pad and to do so i do the following:
1) Create a blank text file in note pad (example: 'inventx')
2) Define the open statement: OPEN (UNIT=10, FILE='inventx.txt', STATUS='REPLACE')
3) Specify the OPEN statement within the WRITE statement (example: WRITE(10, 100) k, v_avg)
The compiler will allow me to build the program no problems but the data is not written to the specified file when the system is run. Can anyone tell me what i am doing wrong?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>1) Create a blank text file in note pad (example: 'inventx')
Unnecessary. OPEN will create a file if it does not exist, if you use STATUS='REPLACE'.
>3) Specify the OPEN statement within the WRITE statement (example: WRITE(10, 100) k, v_avg)
Cannot do that (OPEN within WRITE). Besides, that is probably not what you meant. You simply use the opened unit number in the WRITE statement.
It is customary to CLOSE the file before exiting the program.
>but the data is not written to the specified file
How do you know that? Did you look for the created file in the default directory where the Fortran program created/replaced the file? Did you perform your step-1 in the same directory as the Fortran executable?
Unnecessary. OPEN will create a file if it does not exist, if you use STATUS='REPLACE'.
>3) Specify the OPEN statement within the WRITE statement (example: WRITE(10, 100) k, v_avg)
Cannot do that (OPEN within WRITE). Besides, that is probably not what you meant. You simply use the opened unit number in the WRITE statement.
It is customary to CLOSE the file before exiting the program.
>but the data is not written to the specified file
How do you know that? Did you look for the created file in the default directory where the Fortran program created/replaced the file? Did you perform your step-1 in the same directory as the Fortran executable?
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