- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well I am trying to read a file and make it rank3 array.
forrtl: severe (24): end-of-file during read, unit 5, file /home/milenko/ircg/test_res1.dat
program praviar
implicit none
integer*4 k,n,m
integer,dimension(3) ::s
real,dimension(57,57,57) :: x
open(5,file='test_res1.dat',status='old')
do m=1,57
read(5,100)((x(k,n,m),n=1,57),k=1,57)
100 format(i7,f6.2,i5)
end do
close(5)
s=shape(x)
write(*,*)s
end
I am attaching input file.
forrtl: severe (24): end-of-file during read, unit 5, file /home/milenko/ircg/test_res1.dat
program praviar
implicit none
integer*4 k,n,m
integer,dimension(3) ::s
real,dimension(57,57,57) :: x
open(5,file='test_res1.dat',status='old')
do m=1,57
read(5,100)((x(k,n,m),n=1,57),k=1,57)
100 format(i7,f6.2,i5)
end do
close(5)
s=shape(x)
write(*,*)s
end
I am attaching input file.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a mismatch between the I/O list (all reals) and your format specification. Read an elementary Fortran book or read the compiler documentation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well I have changed I/O:
100 format(f5.2,f6.2,f4.1)
Still I get:
forrtl: severe (24): end-of-file during read, unit 5, file /home/milenko/ircg/test_res1.dat
There is no mismatch now.
100 format(f5.2,f6.2,f4.1)
Still I get:
forrtl: severe (24): end-of-file during read, unit 5, file /home/milenko/ircg/test_res1.dat
There is no mismatch now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a mismatch between the number of items demanded by the I/O list (57 X 57 X 57) and the number of items in the input file (57 X 3). It does not take much effort or expertise to get such basic items under control.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot,I get it now!
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page