1

Possible Duplicate:
How do I save a stream to a file?

I want to write data from a readstream to a file in C#.
Something like the below:

StreamReader log = myexe.StandardOutput;

FileStream logfile = File.Create(LogFileName);

// write log to the logfile  

Any suggestions please.

Community
  • 1
  • 1
ango
  • 829
  • 2
  • 10
  • 23
  • See http://stackoverflow.com/questions/411592/how-do-i-save-a-stream-to-a-file – Jake1164 Jun 27 '12 at 02:04
  • I do not understand it completely. myOtherObject.InputStream does not return StreamReader type. So how do implement it in my code ? – ango Jun 27 '12 at 02:15
  • Then you need to edit your question to reflect your problem because your title states you want to save a streamreader to file, your example has a streamreader... – Jake1164 Jun 27 '12 at 02:20
  • thanks @Jake1164 for pointing out, ill go through my questions and accept the answers I found correct. – ango Jun 27 '12 at 02:27
  • Excellent! You will find the little things you can do for the community will make a difference. – Jake1164 Jun 27 '12 at 02:29
  • And I fixed the problemusing a StreamWriter instead of FileStream to write to the file. StreamReader log = myexe.StandardOutput; StreamWriter logfile = new StreamWriter(LogFileName); logfile.Write(log.ReadToEnd()); – ango Jun 27 '12 at 02:30

0 Answers0