How do I get the current file position from a file descriptor?
I don't see anything like ftell(), for file descriptors.....
Thanks!
Printable View
How do I get the current file position from a file descriptor?
I don't see anything like ftell(), for file descriptors.....
Thanks!
Use lseek(fd, 0, SEEK_CUR). lseek returns the position after the seek, so you get it by simply seeking 0 bytes from the current position.
Why didn't I think of that, must have not read the man page thoroughly....
Thanks CornedBee. :)
Actually, when I had the same problem a few months ago, I actually had to go into the libc source to find the implementation of ftell().