Trying to write the values from a byte array to a text file. When I write the data to a text box on screen it displays correctly, but not when I open the text file. Here's how I display it to the screen:
foreach (ManagementObject FailData in FailDataSet)
{
Byte[] data = (Byte[])FailData.Properties["VendorSpecific"].Value;
for (int i = 0; i < data[0] - 1; i++)
{
for (int j = 0; j < 12; j++)
{
richTextBox2.Text = richTextBox2.Text + data[i * 12 + j] + "\t";
}
richTextBox2.Text = richTextBox2.Text + "\n";
}
}
But when I write data
to a notepad file I get the following:
/ db % dd # ?d 2 cct 3 dd0 ......
Here's how I write the byte array to the text file
File.WriteAllBytes(@"c:\folder\file.txt", data);
How can I write it to a text file the same way it appears on screen?