problems with unformatted file

problems with unformatted file

My module:

module m2

 contains
subroutine wrtrec(iter,n)
integer,intent(in) :: n
integer,intent(in) :: iter
real,dimension(:),allocatable :: x,y,z,t,t0,u,p
real :: x1,y1,z1,t01,u1,p1
integer,dimension(:),allocatable :: q
integer :: id1,id2
character(7)  :: dfile="fd  .tx"
character(6)  :: pfile="rec.  "

allocate(x(n))
allocate(y(n))
allocate(z(n))
allocate(t(n))
allocate(t0(n))
allocate(u(n))
allocate(p(n))
allocate(q(n))

t0=0

  id1=iter/10
  id2=iter-10*id1
  dfile(3:4)=CHAR(id1+48)//CHAR(id2+48)
  pfile(5:6)=CHAR(id1+48)//CHAR(id2+48)
open(32,file=dfile)
open(33,file=pfile)

  do i=1,n
      read (unit=32, fmt=88)x(i),y(i),z(i),t(i),u(i),q(i)
88 format(5f10.3,i3)
if(i.eq.1) then
p(1)=0
else
p=u
end if

      x1=x(i)
      y1=y(i)
      z1=z(i)
     t01=t0(i)
      p1=p(i)
      q1=q(i)

      write(unit=33, form='unformatted')x1,y1,z1,t01,p1,q1
  end do

deallocate(x)
deallocate(y)
deallocate(z)
deallocate(t)
deallocate(t0)
deallocate(u)
deallocate(p)
deallocate(q)

end subroutine

end module

I got :

milenko@milenkons:~/mgtalgarve$ ifort -c -fp-stack-check -g -traceback m2.f90
m2.f90(48): error #6254: This keyword is invalid for this I/O operation.   [FORM]
      write(unit=33, form='unformatted')x1,y1,z1,t01,p1,q1
---------------------^
m2.f90(48): error #7939: A scalar default-character variable is required in this context.   ['unformatted']
      write(unit=33, form='unformatted')x1,y1,z1,t01,p1,q1
--------------------------^
compilation aborted for m2.f90 (code 1)
Why?

8 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

Hi,

Have you tried just using * instead ofform='unformatted'? You could also format it. Example:

WRITE(UNIT=33,'(5E17.8,1I10)) x1,y1,z1,t01,p1,q1

Regards.

Felipe.

I have solved this with:

open(33,file=pfile,form='unformatted')

Sorry for posting here, but I do not know because I can not create a new topic (I've tried several times but does not appear). How could I do to post?

There should be a "New Topic" button on the main forum page beneath the "Announcements" box and to the left. Do you not see this?

Steve - Intel Developer Support

Yes, but when I tried to publish, the post was not published. But now, all is ok, Thanks for your answering Steve.

Regard.

Many posts get held for moderation - you should see a message about that when you post. If that happens, the post will appear soon. We are working to improve the moderation issue.

Steve - Intel Developer Support

Thank you for the clarification. My fault, I did not notice the moderation message.

Regard.

发表评论

登录添加评论。还不是成员?立即加入