バイナリ ファイル内のテキストを検索したいと思います。
単語を見つけたいとしましょうSEQUENCE
。
バイナリリーダーで試しましたが、うまくいきませんでした。バイナリ ファイルからテキストを取得できません。
私の現在のコードは次のようになります。
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);
}
よろしく、
イゴール