Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the tell() function defined?

Can you please tell me where the off_t tell(int fd) function is defined in Mac OS X? It's not in fcntl.h and not in unistd.h, where it is defined in UNIX... I can't use ftell() because the code I'm porting works with file descriptors.

I'm using GCC v4.2.1

like image 599
Ryan Avatar asked Dec 22 '22 13:12

Ryan


1 Answers

You should be able to use lseek instead, which offers the same functionality:

off_t tell(int fd)
{
    return lseek(fd, 0, SEEK_CUR);
}
like image 132
Greg Hewgill Avatar answered Dec 26 '22 10:12

Greg Hewgill