 |
|
 |
My sincere thanks to this author (and to K+K) for making our lives easier! Anything that saves me time and gets the job done so that I can visit with my family is worth posting!!!
For those who would like to do further exploration into additional functionality, this is a great "Hello, world!" app to get you jump-started.
A truly valuable contribution!
|
|
|
|
 |
|
 |
Great post, very easy to use.
One problem I have - if I run Uncompress() and the file to be uncompressed does not exist - instead of getting some kind of error message / exception - I find the thread seems to just hang !
Do you get the same behaviour ?
Whilst I endeavour to ensure my program only uncompresses files that exist it is good programming practice to expect the unexpected - and another process beyond my control *may* have deleted the file in exceptional circumstances.
thanks,
Neil
cheers,
Neil
|
|
|
|
 |
|
 |
I think it's because the code calls _ASSERTE and I was in debug mode with a console application - it is probably waiting on input to a non-existant/invisible window ! Moving on..
cheers,
Neil
|
|
|
|
 |
|
 |
This is great, and would suffice for a number pf projects I can think of. But unfortunately I need to zip a folder containing a couple of files.
Can you recommend the next most simple solution that accomplishes this?
Thanks!
|
|
|
|
 |
|
 |
This works really great, but could it support Unicode file names?
Thanks,
Marty
|
|
|
|
 |
|
 |
Is it possible to compress more than one file in the archive?
when I specify path i get the message "access denied..."
|
|
|
|
 |
|
 |
can if you modify this function bool MyCompress::Compress. zipFile zf(zipOpen(src3, /* bAppend */ true));//set append to true if (ZIP_OK != zipCloseFileInZip(zf)) { _ASSERTE(! "Error"); bReturn = false; } if (ZIP_OK != zipClose(zf, NULL)) { _ASSERTE(! "Error"); bReturn = false; } and finally close the zip after all files appended.
kk
|
|
|
|
 |
|
 |
Hi:
Is possible to read/write zip files in C#?
where I can find out some guide?
thanks
|
|
|
|
 |
|
 |
I tried to compile your class in VS.NET and got the following:
error LNK2005: ___xc_a already defined in msvcrtd.lib(cinitexe.obj)
error LNK2005: ___xc_z already defined in msvcrtd.lib(cinitexe.obj)
error LNK2005: ___xi_a already defined in msvcrtd.lib(cinitexe.obj)
error LNK2005: ___xi_z already defined in msvcrtd.lib(cinitexe.obj)
error LNK2005: __amsg_exit already defined in msvcrtd.lib(MSVCR70D.dll)
error LNK2005: __c_exit already defined in msvcrtd.lib(MSVCR70D.dll)
error LNK2005: __cexit already defined in msvcrtd.lib(MSVCR70D.dll)
error LNK2005: __exit already defined in msvcrtd.lib(MSVCR70D.dll)
error LNK2005: __msize already defined in msvcrtd.lib(MSVCR70D.dll)
error LNK2005: __setmbcp already defined in LIBCD.lib(mbctype.obj)
error LNK2005: _calloc already defined in msvcrtd.lib(MSVCR70D.dll)
error LNK2005: _exit already defined in msvcrtd.lib(MSVCR70D.dll)
error LNK2005: _free already defined in msvcrtd.lib(MSVCR70D.dll)
error LNK2005: _malloc already defined in msvcrtd.lib(MSVCR70D.dll)
error LNK2005: _realloc already defined in msvcrtd.lib(MSVCR70D.dll)
error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
fatal error LNK1120: 1 unresolved externals
warning LNK4098: defaultlib 'LIBCD' conflicts with use of other libs; use /NODEFAULTLIB:library
warning LNK4098: defaultlib 'msvcrtd.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
Is there anything I can do about it?
Thank you.
Best regards,
Eugene
|
|
|
|
 |
|
 |
Tell us why you wrote it, what problems you ran into, why it only supports one file, etc.
Its useful code, but the article is skimpy. I'll vote you a 3.
BTW, don't listen too much to people that critisize and haven't posted their own articles. This is a learning process like everything else in life.
Jason Henderson My articles
"The best argument against democracy is a five-minute conversation with the average voter." - Winston Churchill
|
|
|
|
 |
|
 |
I wrote it because I couldn't find *simple* source code I could just drop into my project, compile, and have it work in under 15 minutes. I didn't want to become a compression expert. I didn't want to spend several days trying to figure out thousands of lines of someone else's code. Yeah, I've implemented LZW in C in my day, but who wants to do *that* again?
The problems I ran into were that people keep posting half-assed solutions to this problem. The web is rife with poorly implemented, difficult to use, ain't-I-brilliant zip code. I wanted something you could understand in under one minute, and I was willing to sacrifice a lot of functionality to meet that goal.
(And I think I did meet my goal: if you can't understand how to use my class in under a minute, you should consider another line of work.)
It only supports one file because it's my understanding that PKZip/WinZip only can read one ZLib-deflated file in an archive. I haven't tested that, so it may be wrong, out-of-date, or otherwise muddled, so caveat emptor.
|
|
|
|
 |
|
 |
Is it possible to compress more than one file in the archive?
when I specify path i get the message "access denied..."
|
|
|
|
 |
|
 |
AFAIK, no. Like the article says, "No, it doesn't support more than one file in an archive..."
If you find a way to do it, you should post it here!
|
|
|
|
 |
|
|
 |
|
 |
I say yes!
Worth reading...
The ratings (and my needs) will determine that.
Keep posting;)
Jerry
|
|
|
|
 |
|
 |
This is too simple and so pointless. If you really want to write your own zip class you might as well do it properly and support the basic functionality required.
|
|
|
|
 |
|
 |
(I will not feed the trolls. I will not feed the trolls...)
Simple? Yup. Pointless? Nope.
The whole idea was *not* to write my own zip class. I have better things to do than re-invent the wheel. Since it does everything I need, it does support my "basic functionality". Your needs may differ, in which case I invite you to create and post your own solution. You may find it more difficult than offhandedly criticizing other's solutions.
And, if you know of an easier way to support PKZip files in an MFC program, even with this limited functionality, please post it. I spent a long time looking, and found nothing.
I eagerly await your response.
|
|
|
|
 |
|
 |
You should write articles that are usful to other people. I dislike article that are a letdown when you read what has been left out. It is good that you have figured out how to read and write zip files, but it is really worth writing an article on it?
A good example of a zip library that is easy to use and powerful is http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx[^].
This is for C#, not C++, but I recommend looking at it because it has good design. It should give you some much needed inspiration.
|
|
|
|
 |
|
 |
It's worth a short article simply because I had no luck finding it anywhere. Can *you* find MFC/C++ (no, not C#, not C, not VB, not Delphi) code that does what my article describes? That compiles and works right out of the box? I had a need to ZIP a file from an MFC program, and didn't want to spend a lot of time developing it. Since I needed it, and found what I'd done useful, I knew others would too. I'm just trying to get some work done, and maybe help someone else. It's that simple.
(Is there any need to be insulting, by the way? "Much-needed inspiration"? Since you don't know know anything about me, or my level of expertise, I can only assume you're a troll, or that you have a really big chip on your shoulder. Good luck with that.)
|
|
|
|
 |
|
 |
I didn't mean to insult you, sorry about that! I meant it genuinely, that code really is worth looking at.
Anyway, my opinion is that this article was not worth posting. Your opinion is different. Let's leave it at that.
|
|
|
|
 |
|
|
 |
|
 |
Who made you the judge of whether this article, or any article for that matter, is useful to others or not? Clearly it isn't useful to you. You've made that abundantly clear.
Personally, I'm tired of reading unconstructive criticism of articles. Nobody benefits from such comments. You are simply clogging up the database.
My advice is that if you don't find an article useful (unless you think it's absolute garbage) LEAVE IT ALONE. Stop reading. Don't waste your time commenting on it. It's as simple as that. Can you not find something better to do with your time?
|
|
|
|
 |
|
 |
thorek wrote:
Who made you the judge of whether this article
That's not really an issue because anyone has the right the give their opinion.
thorek wrote:
tired of reading unconstructive criticism of articles
You are right, my comment was not constructive. I'll do better next time To be honest, I think I was annoyed at the article because I thought it was unnecessary due to there already being a good article on the subject. But I did not say that in the first post, and I was too scathing - when I should have been constructive.
thorek wrote:
Can you not find something better to do with your time?
You make a valid point, don't go over the top though.
|
|
|
|
 |
|
 |
First of all, thanks for your article. Also see this article.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
 |
|
 |
http://www.artpol-software.com/index_zip.html
|
|
|
|
 |