View previous topic :: View next topic |
Author |
Message |
gabriel83
Joined: 21 Oct 2006 Posts: 4
|
Posted: Tue Nov 07, 2006 7:29 pm Post subject: Runtime error when reading external file |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Wed Nov 08, 2006 1:00 am Post subject: Runtime error when reading external file |
|
|
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 |
|
|
gabriel83
Joined: 21 Oct 2006 Posts: 4
|
Posted: Sun Nov 12, 2006 10:35 am Post subject: Runtime error when reading external file |
|
|
Ok thanks!
I solved the problem by using IOSTAT=INTEGER variable in the READ statment.
|
|
Back to top |
|
|
|