As opposed to using StreamReader/Filestream
I want to read binary data from files and show that data (formatted) in a textbox.
So binary data as in potentially non-printable data? Well if you want to print the data out as a hex string, take the data as an array of bytes then convert to a hex representation.
string path = @"path\to\my\file";
byte[] data = File.ReadAllBytes(path);
string dataString = String.Concat(data.Select(b => b.ToString("x2")));
textBox.Text = dataString;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With