James

James

  • NA
  • 6
  • 0

StreamReader -> StreamWriter... file comes out much biogger !!

Oct 11 2009 2:33 PM
Hi,

I am trying to read the date from one file into another a new file.
(I know I could just copy it, but I will eventually be processing the data inbetween so I need to do it this way).


So first I create a StreamWriter with the existing path, then I create a StreamReader with the new path, and copy one to the other.

            StreamWriter writer = new StreamWriter (existingFilePath);
            StreamReader reader = new StreamReader(copiedFilePath);

            string strData = reader.ReadToEnd();
            Writer.Write(strData);

            writer .Close();
            reader.Close();

And the end result.... the new file is about 25mb but the old file was only 19mb.

Is this to do with the encoding? Its a PNG file I have selected but ultimatly it could be any file type.
I need to create an EXACT copy! Please help

James

Answers (1)