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

Newline in fortran

  1. May 11, 2009 #1

    kth

    User Avatar

    program test
    open(50,file='test.dat')
    write(6 ,FMT='(I3,/)') 111
    WRITE(6 ,FMT='(I3,/)') 222
    write(50,FMT='(I3,/)') 111
    WRITE(50,FMT='(I3,/)') 222
    close(50)
    end

    In the above, at the screen i see:
    111
    222
    but in the dat file i see:
    111222

    How can i change line in the file??
     
  2. jcsd
  3. May 11, 2009 #2
    Kth
    When I run the above code compiled with F77 fortran, test.dat contains
    111

    222

    with an extra line between the numbers and after the line 222.
    On the other hand, the first character on the screen has been used for printer carriage control, namely the first 1 had been taken as a new page.

    Are you running with f77 or f90, and on Linux or Windows XP?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Newline in fortran
  1. FORTRAN Help (Replies: 1)

  2. Fortran Help (Replies: 2)

  3. Infinity in fortran (Replies: 5)

  4. Linking Fortran (Replies: 5)

Loading...