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

Fortran 95: formatting of output (ints and chars)

  1. Oct 13, 2011 #1
    Hello. I am a physics student working on research project which involves Fortran 95 code. I am very new to Fortran but I do have an intermediate knowledge of Java. The task I am attempting seems like it should be very simple but there are many subtleties to learning a new language that are making it very time consuming, so after attempting different things all day with no luck I thought I would try here.

    Here is what I need to do:
    At the top of my pre-existing output file I need to write the following exactly in this format:

    text month/day/year hours:minutes:seconds
    text B=value1 G B=value1 G
    text Te=value1 KeV Te=value1 Kev
    text Tau=value3 Tau=value3

    where: text is an arbitrary character string (it's just for filler); month, day, year, hours, minutes, and seconds are integers; value1, value2, and value3 are reals; the units and the B=, Te= etc.... are just characters.

    I am having many problems with this. Mainly working with trying to format combinations of data types and with how to tell it when to write on a new line and when not to.
     
  2. jcsd
  3. Oct 25, 2011 #2
    I always refer to this website http://www.cs.mtu.edu/~shene/COURSES/cs201/NOTES/chap05/format.html (WFS) when I am having issues with FORTRAN I/O. See if it helps.
     
  4. Oct 25, 2011 #3
    Thank you, that is actually the site that I found most helpful as well! I ended up figuring out how to do it after lots of time and much trial and error. I guess that's what it takes! Thank you again. :)
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Fortran 95: formatting of output (ints and chars)
Loading...