title: Insert to file from Hard Disk
body: <p>I'm trying to make a small app (dictionary) that translates from English to Arabic and vice versa.
  I have 2 files in the debug folder English.txt and Arabic.txt.</p>
  
  <p>I am trying in my form to make it possible for the user to insert new words to the files but I don't know if <code>StreamWriters</code> are working while <code>StreamReaders</code> are.</p>
  
  <p>I think that my <code>Seek</code> statements don't work the right way either.</p>
  
  <p>Here is my code that I tried:</p>
  
  <pre><code>    FileStream englishFile = new FileStream("English.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
      StreamReader engSR = new StreamReader(englishFile);
      StreamWriter engSW = new StreamWriter(englishFile);
      FileStream arabicFile = new FileStream("Arabic.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
      StreamWriter arabSW = new StreamWriter(arabicFile);
      StreamReader arabSR = new StreamReader(arabicFile);
  
  
      string line = engSR.ReadLine();
      string[] arr = line.Split('|');
      int numberOfLines = int.Parse(arr[1]) + 1;
  
  
      englishFile.Seek(0, SeekOrigin.Begin);
      engSW.WriteLine("*|{0}", numberOfLines);
      arabSW.WriteLine("*|{0}", numberOfLines);
  
  
      englishFile.Seek(0, SeekOrigin.End);
      line = engSR.ReadLine();
      engSW.WriteLine("{0}|{1}", numberOfLines, englishin.Text);
  
      arabicFile.Seek(0, SeekOrigin.End);
      line = arabSR.ReadLine();
      arabSW.WriteLine("{0}|{1}", numberOfLines, arabicin.Text);
  
  
      arabicFile.Close();
      englishFile.Close();
  </code></pre>
  
  <p>Where <code>englishin</code> and <code>arabicin</code> are the two text-boxes.
  Sadly there is no change that occurs in the file.</p>
  
  <p>I have also tried : </p>
  
  <pre><code>string line = engSR.ReadLine();
          string[] arr = line.Split('|');
          int numberOfLines = int.Parse(arr[1]) + 1;
  
  
          englishFile.Seek(0, SeekOrigin.Begin);
          engSW.WriteLine("*|{0}", numberOfLines);
          arabSW.WriteLine("*|{0}", numberOfLines);
  
  
          //englishFile.Seek(0, SeekOrigin.End);
  
          line = engSR.ReadLine();
          while (line != null)
              line = engSR.ReadLine();
          engSW.WriteLine("{0}|{1}", numberOfLines, englishin.Text);
  
          //arabicFile.Seek(0, SeekOrigin.End);
  
          line = arabSR.ReadLine();
          while (line != null)
              line = arabSR.ReadLine();
          arabSW.WriteLine("{0}|{1}", numberOfLines, arabicin.Text);
  </code></pre>
  
  <p>I don't really know what's the problem with the writer.</p>