C# Convert BINARY to TEXT and then search it
<p>I would like to search for a text in binary file. </p>

<p>Let's say I would like to find a word <code>SEQUENCE</code>.</p>

<p>I have tried with binary reader but didn't have luck. I can't pull text from binary file.</p>

<p>My current code looks like this:</p>

<pre><code>txtSource.Text = string.Empty;
DialogResult result = openFileDialog1.ShowDialog();

try
{
   if (result == DialogResult.OK)
   {
      txtFile.Text = openFileDialog1.FileName;

      string s;

      using (FileStream fs = new FileStream(txtFile.Text, FileMode.Open))
      using (BinaryReader br = new BinaryReader(fs))
      {
          byte[] bin = br.ReadBytes(Convert.ToInt32(fs.Length));
          txtSource.Text = Convert.ToBase64String(bin);
      }
</code></pre>

<p>Regards,</p>

<p>Igor</p>
