1
Answer

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

Ask a question
James

James

14y
4.9k
1
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)