New Reply

Fortran90 problem, runtime error

 
Share Thread Thread Tools
Feb17-13, 02:03 PM   #1
 
Recognitions:
Gold Membership Gold Member

Fortran90 problem, runtime error


Hello, i've been playing around with some code (as shown below) and for some reason everytime i run this code I am told:

At line 11 of file tester.f90
Fortran runtime error: End of file

I'm not really sure whats causing it, is it the position of my Open file?
Any help would be much aprrieiated :)

PROGRAM tester

!Turn off implicit typing
IMPLICIT NONE

INTEGER :: a, b

OPEN(10,FILE='tester.out')

WRITE(10,*) 'Please give value for a'
READ(10,*) a

IF (a < 0) THEN
WRITE(10,*) 'Wrong number'
STOP
END IF

WRITE(10,*) 'Please give value for b'
READ(10,*) b

IF (b > 0) THEN
WRITE(10,*) 'Wrong number'
STOP
END IF

WRITE(10,*) a * b

CLOSE(10)

END PROGRAM tester
 
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> Heat-related deaths in Manhattan projected to rise
>> Dire outlook despite global warming 'pause': study
>> Sea level influenced tropical climate during the last ice age
Feb17-13, 03:00 PM   #2
 
Recognitions:
Homework Helper Homework Help
Are you sure the file exists?

You are writing to the file and reading from it simultaneously. This can cause problems if not done carefully.

When opening the file, FORM ='FORMATTED' should probably be used.
 
New Reply

Tags
fortran, problem
Thread Tools


Similar Threads for: Fortran90 problem, runtime error
Thread Forum Replies
MIPS Runtime Error? Programming & Comp Sci 1
Need help for error in Fortran90! Programming & Comp Sci 6
runtime file reading error Programming & Comp Sci 7
VBA runtime 1004 error Programming & Comp Sci 2
C++ runtime error Introductory Physics Homework 4