forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Runtime error when reading external file

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
gabriel83



Joined: 21 Oct 2006
Posts: 4

PostPosted: Tue Nov 07, 2006 7:29 pm    Post subject: Runtime error when reading external file Reply with quote

I have a very simple problem:

My program needs to read and manipulate datas from a existing file (.txt file, of course...), when compiling it doesn't encounter any errors, but
when I want the .exe program to run, it gives a runtime error every time.

The error is the following one :

Traceback : not available, compile with -ftrace=frame or -ftrace=full
Fortran runtime error : End of file

In the fortran program I open the existing file containing the data in the following way:

OPEN(unit=1, file='C:Fortranibk80-01.txt')
READ (...) ...

the runtime error refers to this line.

It seems to have a problem with the given file's path.
But the path that I gave in the program is absolutely correct.
BUT, the STRANGE thing is...
I don't encounter this error if I open a new file and write something on it.

Can anybody tell me what I can do?
Is it a problem of the compiler?
Should I use another syntax in Windows (maybe the open(unit...) syntax works fine in linux, and not in windows?) ?

Many thanks

Regards
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Wed Nov 08, 2006 1:00 am    Post subject: Runtime error when reading external file Reply with quote

Gabriel

Start by using IOSTAT and STATUS in your OPEN statement.
With IOSTAT you can test the error state after open.
With STATUS you can say that file must already exist.
Use a standard Fortran text to get the details (and to check that I have got the right keywords).
Back to top
View user's profile Send private message AIM Address
gabriel83



Joined: 21 Oct 2006
Posts: 4

PostPosted: Sun Nov 12, 2006 10:35 am    Post subject: Runtime error when reading external file Reply with quote

Ok thanks!
I solved the problem by using IOSTAT=INTEGER variable in the READ statment.

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group