Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

IOStatTest

program IOStatTest
Implicit none
integer :: LineCount=0, IOResult=0
character (length=90) ::LineRead
character (length=90) ::Filename="trajectory.txt"

open (10,file=FileName, action 'read')

read (10, "(A)")LineRead
print "(A)", LineRead
read (10, "(A)")LineRead
print "(A)", LineRead

do
read (10, "(A)",IOSTAT=IOResult)LineRead
if (IOResult<0)EXIT
LineCount=LineCount+1
end do

close (10)
print (A,A,A,IO,A) 'Our file <',FileName,'>had', LineCount,'lines'
end program IOStatTest

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.