SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Appending corrupts files, but no error messages

Last post 05-11-2008 10:11 PM by JohnReilly. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-07-2008 11:56 AM

    • kk68
    • Not Ranked
    • Joined on 04-07-2008
    • Posts 2

    Appending corrupts files, but no error messages

    Suppose you have used DeflaterOutputStream to create a compressed data file. Later you want to add more data by appending:

     BinaryWriter writer = new BinaryWriter( new DeflaterOutputStream(new FileStream(openFileDialog1.FileName, FileMode.Append)));

     Note FileMode.Append.

    Is this supposed to work? It seems that this corrupts the file. How is this supposed to be done, assumed that data written is so large that there's no point in reading it back to memory and rewrite everything again.

  • 05-11-2008 10:11 PM In reply to

    Re: Appending corrupts files, but no error messages

    Hi,

    Is it supposed to work?  Well the answer is not applicable.  Its possible to do but isnt something that is useful to do. Deflation in itself doesnt know about mulitple files/streams.  Thats what Zip, tar and other formats are about. They handle archives of files not a stream of data.

    I suggest rethinkiog what you are trying to achiveve.

     

    hth, -jr-

     

Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.