zipped or unzipped

Nov 26, 2009 at 9:17am
closed account (z8RoizwU)
Hello Folks,
I have to open a file that can either be zipped or unzipped, but is a text file neverthless.

I can use gzgets(from zlib.h) for the zipped version, or simply use fgets (cstdio.h) . Now which one do u suggest would be a faster mode of opening and reading the file. All the functions that are there for unzipped files, are there for zipped also . (Link - http://refspecs.freestandards.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/libzman.html )

Kindly help me with this.

Thanks and Regards
Nishank
Nov 26, 2009 at 1:23pm
That depends. Do you want to get the contents of the zip file; then figure out if it's zipped or unzipped; and convert it to text or just read it if it turns out to be unzipped? Or do you need to unzip the file and then read it?

I think reading the zip file yourself will be much more fun; but it may well be harder...
Nov 27, 2009 at 6:03am
closed account (z8RoizwU)
How do we zip an unzipped text file in c++ or the reverse ?

Any functions that I could use for the same, even from the zlib.h library, would be helpful ...
Please help

Nishank
Nov 27, 2009 at 8:31pm
Topic archived. No new replies allowed.