;****************************************************************************
; Filename: FTELL.ASM
; Author: Adam Seychell
; Version: 0.0
; Created: 1995.April.29
; Updated: -
;****************************************************************************
; Copyright Peter Andersson, 1994-1995.
; All rights reserved.
;****************************************************************************
; Function: ulong @ftell(FILE * file_pointer)
; Comment: returns current position marker of the file referenced by
; file_pointer.
; Input: Eax = file_pointer
; Output: position from begining of file, otherwise -1;
;****************************************************************************
Include STDDEF.INC
Codeseg
Proc ftell, 1
Push Eax
Call @fflush
Cmp Eax,EOF
Pop Eax
Je @@error
Mov Ax, [Eax+FILE._handle]
Clear Edx
Mov Ecx, SEEK_CUR
call @lseek ; do the file seek
@@error:
Ret
Endp
End