How do I get the current file position from a file descriptor?
I don't see anything like ftell(), for file descriptors.....
Thanks!
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.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
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().
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law