title: Saving the console application screen in .txt file
body: <p>I searched lots in internet to store the console application output screen in .txt file. I got the solution but i did not got the desired results. The problem is the text which was not display in console screen was stored in the notepad file. But the text displayed in the console screen was not stored in the notepad file.</p>
  
  <p>For example,</p>
  
  <pre><code>using System;
  using System.IO;
  
  
  static void Main(string[] args)
          {
  
              Console.WriteLine("Text which is displayed in the the console output screen ");
              FileStream filestream = new FileStream("notepad.txt", FileMode.Create);
              var streamwriter = new StreamWriter(filestream);
              streamwriter.AutoFlush = true;
              Console.SetOut(streamwriter);
              Console.SetError(streamwriter);
              Console.WriteLine("Text which is not displayed in the console output screen but it store in the the .txt file");
              Console.ReadKey();
          }
  </code></pre>
  
  <p>In above example<br>
  The line <code>Console.WriteLine("Text which is displayed in the the console output screen ");</code> is just displayed in the console screen but it was not store in the <strong>notepad</strong> file</p>
  
  <p>But the line <code>Console.WriteLine("Text which is not displayed in the console output screen but it store in the the .txt file");</code> is not displayed in the console application screen instead of it was stored in the <strong>notepad</strong> file.</p>
  
  <p>I need to store everything whatever displayed in the console screen even user given details too.</p>
  
  <p>How do I do it?</p>
  
  <p>As I am a beginner, I expecting the answer would be simple.</p>
  
  <p>Thanks in advance!</p>