when i try to open a file that has been compressed with GZipStream (source
from microsoft's 101 Samples for Visual Studio 2005), i get an "invalid
archive" message from winzip, zipgenius and xp's compressed folder app.
using DeflateStream resulted in the same error.
am i missing something simple?
thanks,
Craig Buchanan
<code>
Public Sub CompressFile(By Val sourceFile As String, ByVal destinationFile As
String)
' make sure the source file is there
If File.Exists(sou rceFile) = False Then
Throw New FileNotFoundExc eption
End If
' Create the streams and byte arrays needed
Dim buffer As Byte() = Nothing
Dim sourceStream As FileStream = Nothing
Dim destinationStre am As FileStream = Nothing
Dim compressedStrea m As GZipStream = Nothing
'Dim compressedStrea m As DeflateStream = Nothing
Try
' Read the bytes from the source file into a byte array
sourceStream = New FileStream(sour ceFile, FileMode.Open, FileAccess.Read ,
FileShare.Read)
' Read the source stream values into the buffer
buffer = New Byte(sourceStre am.Length) {}
Dim checkCounter As Integer = sourceStream.Re ad(buffer, 0, buffer.Length)
' Open the FileStream to write to
destinationStre am = New FileStream(dest inationFile, FileMode.OpenOr Create,
FileAccess.Writ e)
' Create a compression stream pointing to the destiantion stream
compressedStrea m = New GZipStream(dest inationStream,
CompressionMode .Compress, True)
'compressedStre am = New DeflateStream(d estinationStrea m,
CompressionMode .Compress, True)
'Now write the compressed data to the destination file
compressedStrea m.Write(buffer, 0, buffer.Length)
Catch ex As ApplicationExce ption
MessageBox.Show (ex.Message, "An Error occured during compression",
MessageBoxButto ns.OK, MessageBoxIcon. Error)
Finally
' Make sure we allways close all streams
If Not (sourceStream Is Nothing) Then
sourceStream.Cl ose()
End If
If Not (compressedStre am Is Nothing) Then
compressedStrea m.Close()
End If
If Not (destinationStr eam Is Nothing) Then
destinationStre am.Close()
End If
End Try
End Sub
</code> 0 2194 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: William |
last post by:
I am using DB2 8.2 on RH Linux 8.0.
I just compiled db2uext2.c but failed to archive the log files, did
anybody fix this problem before? TIA
db2diag.log
2005-06-12-12.39.52.305630-240 I3534G369 LEVEL: Error
PID : 3300 TID : 8192 PROC : db2logmgr
(SAMPLE)
INSTANCE: db2prd NODE : 000
|
by: JezB |
last post by:
From a windows application, I want to provide an "archive" facility which
will scan a specific directory and put specific files into some single
"Archive file", a bit like a zip-file I guess, but more windows standard.
Then I want to provide a function "Import from Archive" which will accept
the name of such an archive file, and be able to extract the files into some
(other) directory (though normally it will be imported on a different...
|
by: Sahil Malik [MVP] |
last post by:
Okay I installed the LINQ preview on Beta2, and anything I write gives me
this error now.
The documentation over here -
http://msdn.microsoft.com/vs2005/currentreadme/default.aspx
aptly tells me --
Also, an exception gets thrown in some cases System.InvalidProgramException:
Common Language Runtime detected an invalid program
|
by: Ian Lane .enizin.net> |
last post by:
Hello,
I am having a very strange issue regarding our macintosh users running IE.
For some reason some users running IE on the Mac are getting an invalid
viewstate exception when first coming to our site.
When first time users come to the site they are redirected to a select
location page where they need to select a country so we can show them proper
pricing. However, users on the Mac seem to have issues during the redirect
back to...
|
by: MrNobody |
last post by:
I need to zip up an 8Gb file using C# - do you know of any freeware libraries
I can use to accomplish this? I guess it needs to be Zip64 to support such
file sizes.
I tried something called sharpziplib but it doesn't support >2Gb files -
they are working on it however but I cannot wait...
| |
by: Sugan |
last post by:
Hi All,
I have a peculiar kind of issue after converting VC and VB code from
Visual studio 6.0 to Visual Studio 2005.
We have the business logic in the VC code which uses the ATL framework
and implements a COM server. VB code gives the GUI part of the project,
For reporting custom errors like invalid login, we use AtlReportError
method to report error from the VC code side.
|
by: =?Utf-8?B?Y2hveWsx?= |
last post by:
Hi,
How can I know if the stream is a gzipped stream or not without .gz extension?
GZipStream does not provide Seek method...
|
by: =?Utf-8?B?QkRSaWNoYXJkc29u?= |
last post by:
Hi,
I have been using the new GZipStream classes, and have been experiencing
problems when attemping to decompress files, which from experience, seem to
be failing when the original file size exceeds something like 64 MB.
For example, when I attempt to decompress a text file of size 1.18 MB to its
original size of 106 MB, I receive the following error message:
System.IO.IOException: Insufficient system resources exist to complete the
|
by: =?Utf-8?B?TWFydGluIE1hZHJlemE=?= |
last post by:
Hi,
i've got problems with CryptoStream and GZipStream. Someone tried that? Or
got any idea why this wont work?
i tried every combination, first i used CryptoStream, after that GZipStream.
Or first i create a file with GZipStream and crypt that file. But become back
the orginal is impossible...
I hope anyone got an idea how this could work.
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 we have to send another system
| |