Register to reply

Fortran90 problem, runtime error

by Saxby
Tags: fortran, problem
Share this thread:
Saxby
#1
Feb17-13, 02:03 PM
Saxby's Avatar
P: 45
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
Phys.Org News Partner Science news on Phys.org
Apple to unveil 'iWatch' on September 9
NASA deep-space rocket, SLS, to launch in 2018
Study examines 13,000-year-old nanodiamonds from multiple locations across three continents
SteamKing
#2
Feb17-13, 03:00 PM
Emeritus
Sci Advisor
HW Helper
Thanks
PF Gold
P: 6,517
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.


Register to reply

Related Discussions
MIPS Runtime Error? Programming & Computer Science 1
Need help for error in Fortran90! Programming & Computer Science 6
Runtime file reading error Programming & Computer Science 7
VBA runtime 1004 error Programming & Computer Science 2
C++ runtime error Introductory Physics Homework 4