Formatted output problem in Fortran

  • Context: Fortran 
  • Thread starter Thread starter chaimluria
  • Start date Start date
  • Tags Tags
    Fortran Output
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 2K views
chaimluria
Messages
2
Reaction score
0
Hello,

I have correctly defined my OPEN and CLOSE statements. When all of my WRITE statements with their associated FORMAT statements are at the end of the program I get the formatted output that I need.

If I move one of the WRITE statements to the body of the program (within a particular DO LOOP) I get a binary output file.

What am I doing wrong. How can I have a WRITE statement in the body of a program and still get formatted output.

Regards,

C. Luria
 
Physics news on Phys.org
It would help to see some code, I've never seen something like that. However, rather than having format specifiers, you could try putting the format in the write statement, e.g.
Code:
DO i=1,n
  WRITE(10,(2G15.3,A4)) data
END DO
 
The problem seems to have resolved itself. I must have made some sort of syntax error. Thank you minger for your reply and suggestion.