      SUBROUTINE READINTFROMCHAR(nout,nint,n1,n2,chardat)

C     SUBROUTINE TO EXTRACT AN INTEGER FROM A
C     CHARACTER STRING

      character*5 cform
      character*(*) chardat

      nout=0
      if ( nint .eq. 0 ) return
      cform='(i0X)'
      if ( nint .gt. 9 ) then
c      write(cform(3:4),'(i2)') nint
       return
      else
       write(cform(4:4),'(i1)') nint
      endif

c     write(6,*) cform,chardat,n1,n2,nint,
c    * chardat(n1:n2)
      read(chardat(n1:n2),cform,err=4) nout
c     write(6,*) 'read in'

      return
4     nout=0
c     write(6,*) 'not read in'
      return
      end 
