문제

Is there a way to do what ftell() does (return the current position in the file) on a raw file descriptor instead of a FILE*? I think there ought to be, since you can seek on a raw file descriptor using lseek().

I know I could use fdopen() to create a FILE* corresponding to the file descriptor, but I'd rather not do that.

도움이 되었습니까?

해결책

Just use:

position = lseek(fd, 0, SEEK_CUR);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top