title: Writing data to a text file
body: <p>I have a simple program where I write 6 of 7 numbers to a text file. Logically everything seems to be fine.</p>
  
  <p>However the numbers are not written to the file as expected.</p>
  
  <pre><code>Random random = new Random();
  
  Console.WriteLine("Please enter the name of the numbers file");
  string fileLotto = Console.ReadLine();
  //creating the lotto file
  FileStream fs = new FileStream("../../" + fileLotto + ".txt", FileMode.OpenOrCreate, FileAccess.Write);
  BufferedStream bs = new BufferedStream(fs);
  Console.WriteLine("File created");
  fs.Close();
  StreamWriter sw = new StreamWriter("../.." + fileLotto + ".txt");
  
  for(int i = 0; i &lt; 6; i++)
  {
      for(int j = 0; j &lt; 7; j++)
      {
          //Console.Write(random.Next(1, 49));
          sw.Write(random.Next(1, 49) + " " );
  
      }
      sw.WriteLine();
  
  }
  sw.Close();
  </code></pre>
  
  <p>The file was created, however no numbers were written to the file...advice perhaps as to why?</p>