473,503 Members | 1,635 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Zip file length ?

Use ICSharpCode.SharpZipLib

Can view files in zip library. Files are being created the wrong size when
unzipped. Sample code I found in this newsgroup. I thought I could change
from s.length to onefile.size, but that doesn't work. Any idea?

Thanks.

Dim zipfile As New ICSharpCode.SharpZipLib.Zip.ZipFile("S:\Temp\test. zip")
Dim onefile As ZipEntry = zipfile.GetEntry("test.txt")
Dim s As System.IO.Stream = zipfile.GetInputStream(onefile)
Dim length As Long = s.Length

Dim bytes(length) As Byte
s.Read(bytes, 0, length)
Dim newfile As New System.IO.FileStream("test.txt",
IO.FileMode.Create)
newfile.Write(bytes, 0, length)
newfile.Flush()
newfile.Close()
Nov 20 '05 #1
1 2506
Masahiro Ito <ma**@pleasespamgoaway.it> wrote in
news:Xn***********************@216.196.105.130:
Use ICSharpCode.SharpZipLib

Can view files in zip library. Files are being created the wrong size
when unzipped. Sample code I found in this newsgroup. I thought I
could change from s.length to onefile.size, but that doesn't work.
Any idea?

Thanks.

Dim zipfile As New
ICSharpCode.SharpZipLib.Zip.ZipFile("S:\Temp\test. zip")
Dim onefile As ZipEntry = zipfile.GetEntry("test.txt")
Dim s As System.IO.Stream = zipfile.GetInputStream(onefile)
Dim length As Long = s.Length

Dim bytes(length) As Byte
s.Read(bytes, 0, length)
Dim newfile As New System.IO.FileStream("test.txt",
IO.FileMode.Create)
newfile.Write(bytes, 0, length)
newfile.Flush()
newfile.Close()


<bump>
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
5809
by: Luiz Antonio Gomes Pican?o | last post by:
How i can store a variable length data in file ? I want to do it using pure C, without existing databases. I'm thinking to use pages to store data. Anyone has idea for the file format ? I...
1
5352
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved...
18
4316
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't...
1
1861
by: Jerry John | last post by:
I am working in ASP.NET with C#. I have a text file which contains datas with delimiters. For example:- MSH|^~\$|DISCHARGE|CLAY COUNTY MEMORIAL|||200502110939| I also have an XML file created...
9
5189
by: Adi | last post by:
Hello eveyone, I wanna ask a very simple question here (as it was quite disturbing me for a long time.) My problem is to read a file line by line. I've tried following implementations but still...
7
2668
by: ConfusedAlot | last post by:
This is my code for a database, whenever i save the database to the file 'database.txt' and display the results i get this; name - (correct, is what i put in) pin - 3435973836 slew rate -...
19
5352
by: Lee Crabtree | last post by:
Is there a class in the framework that allows me read text from a file in an unbuffered manner? That is, I'd like to be able to read lines in the same manner as StreamReader.ReadLine(), but I also...
4
2108
by: MikeJ | last post by:
make a While loop ofs = TextFileServer("somefile") string srow while (ofs=false) { srow=ofs.getRow(); Console.Writeline(srow); }
4
6876
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the...
1
5561
by: shyaminf | last post by:
hi everybody! iam facing a problem with the transfer of file using servlet programming. i have a code for uploading a file. but i'm unable to execute it using tomcat5.5 server. kindly help me how to...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.