!  ftellFortran.f90 
!
!  FUNCTIONS:
!  ftellFortran - Entry point of console application.
!

!****************************************************************************
!
!  PROGRAM: ftellFortran
!
!  PURPOSE:  Entry point for the console application.
!
!****************************************************************************

    program ftellFortran
	use IFPORT
	use IFPOSIX
    implicit none

    ! Variables
    Integer*4 :: I, I1, unit, nTell, istat, ierr
	Integer*8 :: nTell2, n
    ! Body of ftellFortran
    print *, 'FTELL Test'
	unit = 10
	open( NEWUNIT=unit, FILE="data.txt", ACCESS="stream", FORM="formatted", STATUS="UNKNOWN", ACTION="write", IOSTAT=istat )
    if ( istat /= 0 ) error stop
	DO I = 1, 10
		write(unit, *) I
	ENDDO
	close(unit)
	open( NEWUNIT=unit, FILE="data.txt", ACCESS="stream", FORM="formatted", STATUS="old", ACTION="read", IOSTAT=istat )
	DO I = 1, 10
		read(unit, *) I1
		nTell2 = FTELLI8(unit)
		n = FTELL(unit)
		CALL PXFFTELL(unit, nTell, ierr)
		write(*,*) I, ierr, nTell, nTell2, n
	ENDDO
	close(unit)
	

    end program ftellFortran

