Software Archive
Read-only legacy content

Merging Files

Intel_C_Intel
Employee
364 Views
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
0 Kudos
1 Reply
Intel_C_Intel
Employee
364 Views
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
0 Kudos
Reply