Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created .gz-archive not correct? #4

Open
BorysLysyansky opened this issue Nov 4, 2022 · 2 comments
Open

Created .gz-archive not correct? #4

BorysLysyansky opened this issue Nov 4, 2022 · 2 comments

Comments

@BorysLysyansky
Copy link

BorysLysyansky commented Nov 4, 2022

I have tried to start an example output_test.cpp:
#include "ozstream.hpp"
#include <fstream>
int main(void) {
std::ofstream os("test.txt.gz");
zstream::ogzstream gz(os);
for (size_t i = 0; i < 2000; i++)
gz << i << std::endl;
return 0;
}
compiled it with the:
g++ -I.. zlib1.dll output_test.cpp
have run the binary:
./a.exe
The file test.txt.gz was created, but as I've tried to unzip it with:

gzip.exe -d test.txt.gz

I've got an error:
gzip: test.txt.gz: invalid compressed data--length error

What does it mean? Is it possible to decompress the obtained file with some
"standard" software?

Borys

@geromueller
Copy link
Owner

Hi, sorry for the late reply. I can not reproduce your error. If you still have the error, could you try to add a gz.close() after the loop?

@BorysLysyansky
Copy link
Author

Dear Gero,

unfortunatelly, it did not help:

I have used the following output_test.cpp file with the smaller output:

#include "ozstream.hpp"
#include <fstream>
int main(void) {
std::ofstream os("test.txt.gz");
zstream::ogzstream gz(os);
for (size_t i = 0; i < 5; i++)
gz << i << std::endl;
gz.close();
return 0;
}

and have got the following test.txt.gz file (32 bytes):
First 16 Symbols: 1F 8B 08 00 00 00 00 00 00 03 33 E0 32 E4 32 E2
Second 16 Symbols: 32 E6 32 E1 02 00 0D 0A 1A B4 44 0D 0A 00 00 00

If I try to perform the command: gunzip.exe test.txt.gz,
I got the following error messages:

gunzip: test.txt.gz: invalid compressed data--crc error
gunzip: test.txt.gz: invalid compressed data--length error

Could you, please, have a look?

Borys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants