Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there a way to get the file descriptor from gzFile

is there a way can i get the file descriptor form gzFile in program C?

We can get 'fd' from File* like this:

FILE * file

file = fopen("myfile","rt");

int fd = fileno(file);

but now my i want get 'fd' from a var type of gzFile

gzFile gzfile = gzopen("myfile", "rt");

can i get 'fd' from gzfile ?

like image 915
blueyeq Avatar asked Oct 03 '22 05:10

blueyeq


1 Answers

I don't think so, its hidden by the API.

However you could open a file using open() then store away its result and pass it to gzdopen() to get a gzFile.

like image 149
alk Avatar answered Oct 13 '22 02:10

alk