A
andrewcw
Should be simple, I open fileX,
then serialize my content back out ( with position set to
0 ). This works well as long as my new output is larger
than the old file input.
But when my output is smaller, it does not overwrite all
the data and so I get the new output plus the overhanging
piece of FileX.
What the quick way to let resize the stream to just my new
output ? THANKS
code to write out object like this:
stream.Position=0;
serializer.Serialize(stream,obj);
System.IO.StreamWriter Tout = new System.IO.StreamWriter
(stream);
stream.Position=0;
Tout.Close();
then serialize my content back out ( with position set to
0 ). This works well as long as my new output is larger
than the old file input.
But when my output is smaller, it does not overwrite all
the data and so I get the new output plus the overhanging
piece of FileX.
What the quick way to let resize the stream to just my new
output ? THANKS
code to write out object like this:
stream.Position=0;
serializer.Serialize(stream,obj);
System.IO.StreamWriter Tout = new System.IO.StreamWriter
(stream);
stream.Position=0;
Tout.Close();