Search or Read thru a text binary file (.dat)
Im trying to learn how to work with binary text files, at work we have some .dat files and the other team said that its a text binary format. They are large in file size, some as large as 200mb.
I found a few examples on reading the files into a byte array, but so far all the examples seems to be small 1 or 2 lines of strings that they convert to and convert back.
I started with this:
byte[] bHex = File.ReadAllBytes(fileName);
//////Reverse the HEX array for readability
foreach (byte[] c in bHex.Reverse())
{
i++;
// 12 to 21 byte in the reverse order for interseted value in ticks"
if (i > 12 && i < 21)
st.Append(BitConverter.ToString(c));
}
For starters i just want to be able to read thru the file, or i guess output each line/row in the file in a readable format(string)
From the looks of what i can see in the hex editor, its lines of 8 individual 16-bit values in hexadecimal, but considering this is my first or second time working with hex files, not 100% sure.