Microsoft's _ Tell function implementation

Source: Internet
Author: User

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 );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.