- #1
cpburris
Gold Member
- 38
- 4
Not really a question suited for the template...maybe shouldn't put this in Homework section, but it's for a class.
My write files were being weird so I started some investigating. Below is an excerpt from the code.
58 OPEN(unit=33,file='random2.txt',status='unknown')
59 write(33,*)'intitials5'
60 ! Write Statements Working.
61 write(33,*)'initials4'
62 ! Write Statements Not Working.
I've included line numbers for reference. Directly copy and pasted from my code. Compiled using Cygwin with gfortran/GCC. No errors compiling. Written in Fortran 90. The write statement on line 59 works just fine, the write statement on line 61 does absolutely nothing. At least the first time I run the code the first write statement works. If I try and run it a second time, neither write statement works and I end up with an empty file. However, if I run this program,
program Test
OPEN(unit=33,file='random2.txt',status='unknown')
write(33,*)'Test'
end program Test
then run my main program again, the first write statement works again, but not the second.
I am so completely confused. I can provide more of the code if need be, but I can't see how other parts of the code could cause write statements separated by a single line of notes to behave like this.
My write files were being weird so I started some investigating. Below is an excerpt from the code.
58 OPEN(unit=33,file='random2.txt',status='unknown')
59 write(33,*)'intitials5'
60 ! Write Statements Working.
61 write(33,*)'initials4'
62 ! Write Statements Not Working.
I've included line numbers for reference. Directly copy and pasted from my code. Compiled using Cygwin with gfortran/GCC. No errors compiling. Written in Fortran 90. The write statement on line 59 works just fine, the write statement on line 61 does absolutely nothing. At least the first time I run the code the first write statement works. If I try and run it a second time, neither write statement works and I end up with an empty file. However, if I run this program,
program Test
OPEN(unit=33,file='random2.txt',status='unknown')
write(33,*)'Test'
end program Test
then run my main program again, the first write statement works again, but not the second.
I am so completely confused. I can provide more of the code if need be, but I can't see how other parts of the code could cause write statements separated by a single line of notes to behave like this.
Last edited by a moderator: