Stream Closing

Ross Killip replied to Drew Miller at 22-May-08 06:42
I agree fully with drew - if for instance you want to zip a folder contents using this awesome bit of code, then delete the original files, to ensure the files are not locked by the zipping process (and thus can't be deleted) you need to ensure the ostream is closed, either by adding the line:ostream.Close(); after the oZipStream.Write(obuffer, 0, obuffer.Length); or by using using statements :)
Nice code snippet though, cheers. :)


                   
             

Click here to sign in and reply. You could earn money via our $500 contest just for being helpful.
  Article Discussion: Zip / Unzip folders and files with C# - Peter Bromberg  04-Feb-08 12:01 12:01:37 PM
      How to use this "utility class" to zip and store one excel file? - Ashok kumar  14-Feb-08 05:33 5:33:13 AM
          If you want to zip and store one Excel file - Peter Bromberg  02-Mar-08 07:47 7:47:23 PM
      Framework 2.0 - Doug Odegaard  21-Feb-08 03:16 3:16:31 PM
          Correct. - Peter Bromberg  02-Mar-08 07:45 7:45:32 PM
              DotNetZip - Doug Odegaard  13-Mar-08 09:25 9:25:38 AM
      Cleanup - Drew Miller  02-Apr-08 10:32 10:32:35 AM
          Stream Closing - Ross Killip  22-May-08 06:42 6:42:25 AM
      ICSharpCode multiple RAR - padmanaban v  05-Sep-08 04:58 4:58:24 AM
View Posts