I am able to compress certain content with "gzip" format and store it in a file. This content can be decompressed programatically within my code.
But I can't "gunzip" them using command line or other tools. e.g. "Hello World" (11 bytes) is compressed properly as 'test.txt.gz', but upon double clicking or from command line, it gives below error:
On the other hand, if I store the same content in the .txt file and gzip that .txt, then it's decompressed properly.
What is the correct way to store gzip content into a file?
Here is the C++14 source code used for compression/decompression (Referred from: Compress string with GZip using qCompress?).
Hex dump (xxd -p /home/milind/Desktopp/test.txt.gz
):
1f8b080000000000000b789cf348cdc9c95728cf2fca49010018ab043d52
9ed68b0b000000