- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would like to know how to include a file inside another file. The
program that I am trying to write is something as follows
Open (unit=10, file="output.txt", status='unknown')
Open (unit=20, file="FileA", status='old')
OuterLoop: do i = 1, 20
write(10,*)i
!I would like to include the complete contents of FileA here
write(10,*)i,i,i
Endo OuterLoop
close(10)
close(20)
My question is how do I include the contents of FileA inside the file
output.txt
Thank you very much
...Animesh
program that I am trying to write is something as follows
Open (unit=10, file="output.txt", status='unknown')
Open (unit=20, file="FileA", status='old')
OuterLoop: do i = 1, 20
write(10,*)i
!I would like to include the complete contents of FileA here
write(10,*)i,i,i
Endo OuterLoop
close(10)
close(20)
My question is how do I include the contents of FileA inside the file
output.txt
Thank you very much
...Animesh
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not sure if this is what you're looking for, but in my experience with files, you need to read FileA to a variable and then write that variable to your output file. The variable can be formatted any way you need, or written entirely as a string.
I hope this helped you out.
hnnhjo
I hope this helped you out.
hnnhjo

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