Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Formatted output problem in Fortran

  1. Apr 6, 2010 #1
    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
     
  2. jcsd
  3. Apr 6, 2010 #2

    minger

    User Avatar
    Science Advisor

    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 (Text):

    DO i=1,n
      WRITE(10,(2G15.3,A4)) data
    END DO
     
     
  4. Apr 7, 2010 #3
    The problem seems to have resolved itself. I must have made some sort of syntax error. Thank you minger for your reply and suggestion.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook