Click here to Skip to main content
11,932,945 members (63,146 online)
Click here to Skip to main content
Add your own
alternative version


47 bookmarked

Zip and Unzip from a C# program using J# runtime

, 25 Apr 2004 CPOL
Rate this:
Please Sign up or sign in to vote.
Zip and Unzip from a C# program using


There are a lot of libraries to work with zip files. I found a very easy way to work with zip files from a C# program. The Microsoft .Net Framework 1.1 comes with new language: J#. Let's look at it a little. For sure, Java is a parent of it; if so, is somewhere here! I spent a few minutes and found it in vjslib.dll. Let's do the work. Start a new C# project and select Windows Application. Our goal is something like that:

All we need to do is: add reference to our project:

Now, we can use it:

// Output stream fos = new; 

// Tie to zip stream zos = new; 

// Stream with source file fis = new; 

// It's our entry in zip ze = new; 

sbyte[] buffer = new sbyte[1024]; 
int len; 

// Read and write until done 
while((len = >= 0) 
    zos.write(buffer, 0, len); 
// Close everything 


That's all! Demo application is included.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Valeri Makarov
Software Developer
Russian Federation Russian Federation
Over 12 years of experience as a Software Developer/Engineer, development and production support applications for MS DOS, MS Windows.
Certified C Programmer
Certified C++ Programmer
Certified Visual FoxPro Programmer
Certified C# Programmer

You may also be interested in...

Comments and Discussions

QuestionWhat about cyrillics? Pin
chien-andalou16-Jul-09 6:32
memberchien-andalou16-Jul-09 6:32 
GeneralHanging onto corrupt file Pin
terry summers22-Mar-09 11:16
memberterry summers22-Mar-09 11:16 
Questionunzipped progress status Pin
byteway2-Oct-07 22:38
memberbyteway2-Oct-07 22:38 
QuestionUnzip file stored in database Pin
mikebiro1-Oct-07 13:11
membermikebiro1-Oct-07 13:11 
QuestionCan I zip without folder structure? Pin
jupinno_ys15-Aug-07 22:57
memberjupinno_ys15-Aug-07 22:57 
AnswerRe: Can I zip without folder structure? Pin
PranaySharma8427-Aug-07 4:55
memberPranaySharma8427-Aug-07 4:55 
GeneralProblem in unzip Pin
hamidreza Talebi7-Aug-07 2:18
memberhamidreza Talebi7-Aug-07 2:18 
QuestionSize of Zipped File Pin
kyreddy26-Jun-07 5:00
memberkyreddy26-Jun-07 5:00 
Generalzip files with password Pin
Member #112974824-Feb-07 3:21
memberMember #112974824-Feb-07 3:21 
GeneralRe: zip files with password Pin
Valeri18-Apr-07 20:47
memberValeri18-Apr-07 20:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.151126.1 | Last Updated 26 Apr 2004
Article Copyright 2004 by Valeri Makarov
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid