 |

|
use with #pragma comment(lib,"zlib/libs/zlib")
have
xxxxxx.obj : error LNK2019: public: bool __thiscall zlib::CGZip::Open(wchar_t const *,enum zlib::CZipper::EArchiveMode)" (?Open@CGZip@zlib@@QAE_NPB_WW4EArchiveMode@CZipper@2@@Z)"
xxxxxx.obj : error LNK2001: public: virtual bool __thiscall zlib::CGZip::WriteString(wchar_t const *)" (?WriteString@CGZip@zlib@@UAE_NPB_W@Z)"
|
|
|
|

|
fix it - copy gzip.cpp and gzip.h to my project.
At first I thought I could get from the library of a class CGZip )
|
|
|
|
|

|
I like it. Its very well written, and I am going to use it in my project
|
|
|
|

|
Can I use CGZip class to unzip gzip data in memory? For example i get gzip data from somewhere (HTTPS request in my case). I can not save data to file because security reasons.
|
|
|
|

|
There are two file in an archive and I need to get to one of them.
How can I do this?
|
|
|
|

|
This is by-far not unicode compliant. I am very surprised no one has brought this up.
Try opening a file with Unicode characters in the file name. It fails.
When you call magical "Wide to Mutibyte" API, you lose details about the wide string.
My work-around for this is to call GetShortPathName() on the filename before sending to gZip. GetShortPathName() will convert the unicode characters to short-path syntax so when you use your Wide2MB API it will return a correct path.
Obviously for writing, this can be a problem, but i am sure you can figure it out.
|
|
|
|

|
Hi Jonathan,
I am using the GZipWrapper in my MFC application. When i am trying to unzip the output text is appended at the end some I'I'I'I'I'I'I'I'I'I'..................
I am unable to trance where is the problem....
Can you help on this issue.
Thanks&Regards,
Ravi Sankar,
ravi_yadavalli@yahoo.co.in
ravi sankar
|
|
|
|

|
Note setting nocompression does not write plain text files.
About every 64K there is a block of binary to mark a new buffer.
|
|
|
|

|
I agree with the Linux guy - I need support that works with Windows and MacOS (CodeWarrior and XCode). This is a limited solution that is only good for Windows and also expects that you are using Windows-specific code (LPCTSTR). I'm using a C++ plugin SDK - and I am definitely not using anything Windows-specific (ever!).
Why does zlib live in the 80s/early-90s? Do they not think that filesystems use UNICODE and other multibyte character systems for file/folder naming these days?
I'll keep looking for a real solution...
|
|
|
|

|
Hello, my question is, how can i compile the cgzip on linux?
It needs atl what is in windows, but i don't found atl in linux.
|
|
|
|

|
when I have done follow the introduction and to link my project there have an erro "fatal erro:LNK1104 cannot open file "zlib.lib".I don't know how to solve it.
|
|
|
|

|
I have a 100mb gzip file. Unzipping the whole thing will take up 2GB memory. So unzipping on the fly is prefered. How would I go about doing that using this gzip wrapper?
|
|
|
|

|
I have this problem, that occurs only sometimes:
-i compress a file (with no errors)
-then i decompress it (also with no errors)
the problem is that the decompressed file is diferent (not in size, but the content is different) from the original file.
Note that this problem only occurs rarely, but has very negative impact on the application that i'm building. Is there any way to prevent this? Can you help me?
Renato S. Gaio
|
|
|
|

|
Hello,
Does anyone knows a library to decompress zip files.
I am trying to decompres files compressed with win zip .
Do you know if I can still use CGZip ?
|
|
|
|
|

|
is it only me that feels that the filesize is getting bigger each time i create a new file? was wondering if the header appended at the front and back of the file is being removed during the deflation or is there anything wrong with this code
if (!gzip.Open(_T("test"), CGZip::ArchiveModeRead))
{
printf(_T("Cannot read file\n"));
exit(-1);
}
void * pBuffer=NULL;
unsigned int size;
gzip.ReadBuffer( &pBuffer, size );
gzip.Close();
if (!gzip.Open("test2", CGZip::ArchiveModeWrite))
{
printf(_T("Cannot create file\n"));
exit(-1);
}
gzip.SetCompression( CGZip::CompressionModeNoCompression );
gzip.WriteBuffer( pBuffer, size );
gzip.Close();
|
|
|
|

|
Can´t someone provide me CGZip (C++ wrapper) using the latest zlib? (1.2.2)
grandamoca
|
|
|
|

|
How do i use this code to decompress a .gz file stored on the internet?
Thnx...
|
|
|
|

|
Dear Jonathan,
Firstly let me thank you for making this easy for us newbies. Your wrapper was easy to use and does a great job.
One thing I am having problem is though is that I am building XML Dom trees for SVG docs using MSXML4, it all works fine if the XML data does not contain any wchars, and the XML is written to an .svgz document using CGZIP with no problem. What I have found however is that when there are occasional unicode characters involved in the XML data, the gzip produced will truncate some data towards the end of the document generated when I check the source (SVG viewer supports svgz which is a gzipped XML doc). I experimented with changing the line where WriteString calls the method WriteBuffer and giving it instead of sizeof(TCHAR), a sizeof(WCHAR). This way the XML data is passed on all well but I find possibly binary characters (or null) running over the end of the XML data so effectively it's gzipping blanks after the XML data source runs out.
Therefore I wonder if there is anything that I can do to rid this problem? How can I make XML data containing occasional Unicode work with CGZip? Or is there a way (algorithm) to calculate the real byte length of the XML data string containing bits of Unicode chars.
Thanks,
Julius
|
|
|
|

|
Have you defined appropriate Unicode macros which will user wchar_t for TCHAR, instead of (default) plain char? I think that all you need is "#define _UNICODE" or include "_UNICODE" in the compiler option list (exclude MBCS if it's defined there). Take a look at MSDN docs on TCHAR or CString (which is of TCHAR type, so is treated as char or wchar_t). -- "If you think that knowledge/education is expensive, would you try ignorance?" Vatroslav 'Ziggy' Mihalj, B.Sc.Computer Science Member of HUPRO, ACM, IEEE, IEEE Computer Soc. and Communications Soc.
|
|
|
|

|
there's a problem here...
Even though it compiles UNICODE, it doesn't support it.
When you:
m_gzf = gzopen(T2CA(szFileName),"rb");
You downgrade a unicode string to an ansi string. If the filename contains international characters, then it doesn work!
gzopen doesn't even su
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Peter Weyzen
Staff Engineer
SoonR Inc.
|
|
|
|

|
Yep, the zlib code is unchanged, as far as I can see. The real problem is the non-compliant underlying zlib code. The only trick I know to get around this, on NT systems that still create short names (don't have them turned off), is to convert long (Unicode) paths to short (ANSI) paths. This will ensure the file is found and avoids name mangling.
- Pfft. Coddled kids. In my day, we used to telnet to port 80, then render the page with pencil and paper-- and that's the way we liked it!
- Pshaw! Youngster. Your UID barely fits inside 16 bits. In _my_ day we had to whistle the 1's and 0's through an acoustic coupler!
|
|
|
|

|
:(I call the function SetCompression() to set the compress mode,but the result is the same with using the default compress mode, How can I do?
|
|
|
|

|
I've bee trying to integrate the CGZip class with an MFC based application in Visual C++ v6.0. I run into confilcts with standard MFC libraries as seen below:
LINK : warning LNK4049: locally defined symbol "_sprintf" imported
LINK : warning LNK4049: locally defined symbol "_fclose" imported
LINK : warning LNK4049: locally defined symbol "_fprintf" imported
LINK : warning LNK4049: locally defined symbol "_fopen" imported
LINK : warning LNK4049: locally defined symbol "__close" imported
LINK : warning LNK4049: locally defined symbol "__open" imported
LINK : warning LNK4049: locally defined symbol "__setmbcp" imported
AboutDlg.obj : error LNK2001: unresolved external symbol __imp___getdiskfree
AboutDlg.obj : error LNK2001: unresolved external symbol __imp___getdrive
I'm not very good at linking projects, are there any project settings that I can set to prevent the conflict??
Rick
|
|
|
|

|
I managed to get the code to compile and work within my application by including the zlib.lib file. I tried downloading the original ZLIB source file to generate my own library file by was dismally unsuccessful. Can anyone offer any advice as to:
-what a simple procedure is for creating library files
-should i be concerned that my link settings for my new project look completely different from the link settings in project code
Thanks in advance folks,
Rick
|
|
|
|
|
|
|

|
I need something that is platform independent(linux and windows is the requirement) to archive files. I think this is what I need but how do I do that with multiple files. i.e I want to group 5 files that I know the locations of into 1 archive and later ungroup them. Can someone show me how to do that like how u showed in the demo to create a new txt file and compress it.
|
|
|
|

|
Try the article about XZIP which implements multiple file handling...
Jonathan de Halleux.
|
|
|
|

|
Thank you, Jonathan. Very useful code!
Best regards,
Eugene
|
|
|
|

|
You check out my new article zipstream where zipping is done through STL streams.
Jonathan de Halleux.
|
|
|
|

|
Hi
I saw the CGZip class and it is exactly what I need. Thanks. I have one question .. how do I put multiple files in a single gz archive.
Animesh
|
|
|
|

|
The easiest method is to tar and then compress the tar file...
Jonathan de Halleux.
|
|
|
|

|
I want to be able to compress/decompress from one buffer to another. Is this possible? I have no file system to work with. further more, is it possible to unzip a certain number of bytes only?
|
|
|
|

|
rowby wrote:
I want to be able to compress/decompress from one buffer to another.
CGZip is wrapper around the gz methods provided with gzip.
Ultimately, I (or someone else) will go deeper into the gzip library and bypass these gz methods. At that time it will be possible to compress-decrompress from IStream to IStream...
Until then, the answer is no.
rowby wrote:
It possible to unzip a certain number of bytes only?
Yes, just modify the read buffer method. If you look in it you will see the gzread is called. gzread takes the number of byte to read
Jonathan de Halleux.
|
|
|
|

|
This feature is built-in in zlib. See compress and decompress functions.
Jonathan de Halleux.
|
|
|
|

|
I feel very silly asking this question, but where is the implementation, not the demo?
This class seems exactly what I'm looking for...
Peter
|
|
|
|

|
The class CGZip is implemented in the file gzip.h, gzip.cpp.
The files are to be found in the demo.
Jonathan de Halleux.
|
|
|
|

|
Actually, they aren't included
gzip.h is available in the help file, but no sign of gzip.cpp.
Can you please update the demo project to include them?
Thanks
Colin
|
|
|
|

|
Hello everyone,
I used gzip class.
I have a file : aaa.tar.gz.
I do as example above, the result I get is pBuffer = "aaa.tar". So I dont know what I have to do for decompress that file ?
Please give me any ideas.
Thanks
E-Mail vthieuanh@yahoo.com
|
|
|
|
|

|
Hello,
Thks for your reply.
I know, untar ispart of GNU. and I haved a look in their sites already.
BUT :
My application is to extract the files in TAR,GZ,GZIP formats.
My application is available on Windows OS, NOT UNIX.
So, I want to have an example ( of Visual C, Windows OS) to decompress the file which was compressed in TAR,GZ formats.
For example : I have a file aaa.tar.gz and I want to extract that file.
your demo can extract that file ???
Please give me any ideas.
I am waiting for your reply.
Best regards.
THIEU Anh-Van
E-Mail vthieuanh@yahoo.com
|
|
|
|

|
vanta wrote:
For example : I have a file aaa.tar.gz and I want to extract that file.
your demo can extract that file ???
The demo will extract the file to aaa.tar and then it's up to you to untar it.
My idea:
Get the source at GNU site and compile it.
Read carefully the license and see if it is ok with the usage you want to do with your application.
Jonathan de Halleux.
|
|
|
|

|
I've a better CGzipFile that can be used interchangeably with CFile and CStdioFile. It also compresses MFC serialized document data. Check it out at http://www.users.bigpond.net.au/pinnacleplus/gzipfile.html
|
|
|
|

|
Please find a better way to advertise your product.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|

|
Hello everyone,
As somebody discussed and the source code I downloaded, I think this class can gzip,gunzip the SINGLE file only. For example, If I have a file : xxx.TAR.gz. Before compresing,the xxx is one folder which has some files. So, how can I know what files included in that folder ?
How I can Untar the file ? Please tell me if you can.
Thank you.
vanta
THIEU Anh-Van
Programmer - VNTeam Company
Room No 408,123 Truong Dinh st,Dist. 3,HCM City,Viet Nam
Tel: +84 (8) 932 1045
E-Mail vthieuanh@yahoo.com
|
|
|
|

|
Untarring a file is another problem (untar is part of GNU)
Sorry, I do not have the time to look at it...
Jonathan de Halleux.
|
|
|
|

|
Is there no way to simply gzip and gunzip a file? I do not wish to work with the buffer just zip and unzip a file.
Something like CGZip::Compress(OldfileName.tar, fileName.gz);
and CGZip::UnCompress(fileName.gz, NewFileName.tar)
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
 |