11File_Output - FILE OUTPUT IOSTAT File I/O Statements OPEN...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
FILE OUTPUT IOSTAT
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
File I/O Statements OPEN statement READ statement WRITE statement CLOSE statement Must open file before we can use it Getting data into variables into our program Write statement- puts data into file so we can use it Close- don’t want to leave resources open. If fortran is still accessing the file, it may be unavailable to other users.
Background image of page 2
OPEN statement (for WRITE) STATUS- ‘OLD’, ‘NEW’ or ‘REPLACE OPEN(UNIT=unit_number,  FILE=filename,  STATUS='NEW‘,  ACTION = ‘WRITE’,           IOSTAT=integer_var)                        
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
WRITE statement WRITE (UNIT = unit, FMT = fmt, OPTIONS = opt) expr_list unit Number- read from file P *- read from keyboard P String- use the string fmt *- default P FORMAT statements P String- use the string opt IOStatt - 0,Positive or Negative Write (*,*) is the same thing as saying write(unit=*,FMT=*)
Background image of page 4
WRITE ALTERNATIVES (TO SCREEN) REAL :: X, Y CHARACTER(20) :: F F = '(1X, F6.2, F5.2)' 1 FORMAT (1X, F6.2, F5.2) X=100.25 Y=12.23 WRITE(*,*) X, Y WRITE(*,1) X, Y WRITE(*,'(1X, F6.2, F5.2)') X, Y WRITE(*,F) X, Y WRITE(*,*) WRITE(UNIT=*,FMT=*) X, Y WRITE(UNIT=*,FMT=1) X, Y
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
REAL :: X, Y
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/30/2009 for the course CGS 2421 taught by Professor Onal during the Fall '09 term at University of Florida.

Page1 / 17

11File_Output - FILE OUTPUT IOSTAT File I/O Statements OPEN...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online