How to read a binary file into a byte array using WinForms in C#

1 Answer

0 votes
namespace WinFormsApp1 
{
    public partial class Form1 : Form
    {
    public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            byte[] array = File.ReadAllBytes("D:\\data.bin");

            MessageBox.Show(array[0] + " " + array[1] + " " + array[2] + " " + array[3]);
        }
    }
}



/*
run:

255 216 224 74
 
*/

 



answered May 27, 2024 by avibootz
...