      program clairc3d
      parameter(nxm=400,nym=400,ncm=10)
      real*4 x(nxm),y(nxm),z(nxm,nym,ncm)
      character*128 fich
      
      call lifich('Prefix of the .c3d ?',0,fich,lfich)
      open(1,file=fich(1:lfich)//'.c3d',form='unformatted'
     &    ,status='old')
      read(1) nx,ny
      if (nx.eq.0) then
        icoo = ny
        read(1) nx,ny
      else
        icoo = 0
      endif
      if (nx.gt.nxm.or.ny.gt.nym) then
        print*,'Too many points : nx =',nx,',  ny =',ny
        stop
      endif
      open(2,file=fich(1:lfich)//'.c3d.clair')
      if (icoo.ne.0) write(2,*) 0,icoo
      write(2,*) nx,ny
      read(1) (x(i),i=1,nx),(y(j),j=1,ny)
      write(2,*) 'X --------------'
      do i=1,nx
        write(2,*) x(i)
      enddo
      write(2,*) 'Y --------------'
      do i=1,ny
        write(2,*) y(i)
      enddo
      do k=1,ncm
        read(1,end=1000,err=1000) ((z(i,j,k),i=1,nx),j=1,ny)
        do j=1,ny
          write(2,*) 'Z(1,',j,') surface',k
          do i=1,nx
            write(2,*) z(i,j,k)
          enddo
        enddo
      enddo
1000  close(1)
      close(2)
      end
      
      
      
