Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I output a real number to file

Status
Not open for further replies.

marrisa

Technical User
Nov 26, 2004
8
TT
Dear Members,

I am trying to write a real(8) variable to a text file. The number is of the form -1.2E-03. I am using the edit descriptor, F7.4 because I want to write it in the form,-0.0012. I am getting an iostat error 61 and I think this means that I am using the incorrect descriptor. How do I write the variable to the file in the form that I require?

Thanks so much for your help

Regards
Marrisa
 
Does the following work?
Code:
      program pfloat
      real x
      x = -1.2E-3
      print *, 'Using inline format'
      print '(F7.4)', x
      print *, 'Using Format Stmt'
      print 100, x
100   format (1X, F7.4)
      stop
      end
If it does, then it could possibly be your open statement. How have you opened the file: formatted or unformatted?
 
Yes it does, thanks alot...My error was that I was using an incorrect descriptor for the seperator space between numbers in the file, I was using 'A1' instead of '1X', your usage of '1X' actually reminded of this...thanks again...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top