fgets & zlib

G

giuseppe.cannella

i need to read a row on a gzipped file like the fgets function does on
a text file

can you help me to find this function

thank
 
W

Walter Roberson

i need to read a row on a gzipped file like the fgets function does on
a text file
can you help me to find this function

You mean something like the gzgets() function that is
documented in zlib.h -- documentation that is referred to on
the zlib manual page, and in the zlib README file at the top
level of the zlib distribution?

If so, then the question falls outside the scope of what is
defined in the C language standard, and is thus not
appropriate for comp.lang.c; you should consult
documentation specific to your implementation.
 
J

Jens Thoms Toerring

i need to read a row on a gzipped file like the fgets function does on
a text file
can you help me to find this function

I hope I understand you correctly when I assume that you want
to read a line from a file that is currently zipped and don't
want to unpack it to a file on disk before reading the line.
In that case you will have to use a third-party library since
the C language doesn't come with support for dealing with zip-
ped files. I don't know if a library exists that allows you to
read lines from zipped files, but a good starting point for a
search for something like this might be

http://zlib.net.

There you also find a link to a mailing list dedicated to zlib,
perhaps someone there will be able to tell you more.

<OT>
If you are on a system that has something like the (non-C-stand-
ard but POSIX) function popen() and you don't care about porta-
bility to systems that don't you could use that function to start
the 'unzip' program to extract the zipped file to stdout and then
use fgets() on the FILE pointer popen() returns on success.
</OT>
Regards, Jens
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,150
Latest member
MakersCBDReviews
Top