byte[] buffer = new byte[1]; sread = new System.IO.FileStream(@"C:\Users\mm\Desktop\code.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read); swrite = new System.IO.FileStream(@"C:\Users\mm\Desktop\0.txt", System.IO.FileMode.Create, System.IO.FileAccess.Write); System.IO.Compression.GZipStream g = new System.IO.Compression.GZipStream(swrite, System.IO.Compression.CompressionMode.Compress,true); br = new System.IO.BinaryReader(sread); bw = new System.IO.BinaryWriter(swrite); while (true) { try { buffer= br.ReadBytes(1); g.Write(buffer, 0, 1); } catch { break; } } sread.Close(); swrite.Close(); br.Close(); bw.Close();
GZipStream
MSDN
ReadBytes()
Write()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)