Microsoft's _ Tell function implementation
Wentao sun. Autodesk, Inc. (Shanghai, China .)
Microsoft's _ Tell function can return the position of the current file operation pointer Based on handle (INT.
There is no similar function on Linux and Mac OS X, but its internal implementation is not particularly complicated.
PS:
Similar concepts on Linux and Mac OS X are ftell, but the first input parameter is file *, where it is int.
/* **
* Tell. C-find file position
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* Purpose:
* Contains _ tell ()-find file position
*
**************************************** ************************************** */
# include cruntime. h >
# include Io. h >
/* **
* long _ tell (filedes)-find file position
* purpose:
* gets the current position of the file pointer (no adjustment
* For buffering ).
* entry:
* int filedes-file handle of file
* Exit:
* returns file position or-1l (sets errno) if bad file descriptor or
* pipe
* exceptions:
*
********************************* **************************************** * ***** */
long _ cdecl _ tell (
int filedes
)
{< br> return (_ lseek (filedes, 0l , 1 );
}