Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Is there any way to solve read error?

brb36641
Beginner
853 Views
Hello, I have a question as follows.
I got an error message from my program.
fortl:severe(24): end-of-file during read, unit1, file cpppfile-name.log
Image PC...
DFORRTD.DLL
My program sorce ocde.
open(1,file=cpppfile-name.log)
read(1,'(i3)',err=11)tmpst
close(1)
11 goto 50
...
50 return
file-name.log size is 0 byte. Therefore I quess read statement would faild.
How should I fix this error? Please give me hands, please.
0 Kudos
5 Replies
onkelhotte
New Contributor II
853 Views

Just try a do while loop... And treat the filename as a string!

open(unit=1,file='cpppfile-name.log')
do while (.not. EOF(1))
read (1,'(i3)') tmpst
end do
close(1)

HTH, Markus

0 Kudos
greldak
Beginner
853 Views
Is your path correct - i.e do you have a folder called c containing a subfolder called ppp at the level you are running the program from - or did you mean c:
0 Kudos
Jugoslav_Dujic
Valued Contributor II
853 Views
ERR= label is not triggered when an end-of-file is reached; that's as it should be – you need an END= label instead. If you want to treat both EOF and other errors in the same way, you can specify both, or use IOSTAT=.
0 Kudos
Intel_C_Intel
Employee
853 Views

Hello,

This code should force any read error to jump to line 1100.

read (ZMESG,*, err=1100, IOSTAT=IERR) XX, YY
if (IERR .NE. 0) goto 1100

Hope this works,

Lars Petter

Message Edited by lpe@scandpowerpt.com on 03-24-200607:40 AM

0 Kudos
brb36641
Beginner
853 Views
Hello, I appreciate all of answering my issue.
I want to say thank you very much for suggestions.
All suggestions give me oppotunity to get important experiments.
Thank you again.
0 Kudos
Reply