Right. That writes (34 23 00 F2) to a file in binary (specifically NOT text).Code:byte[] buff = new byte[4]; buff[0] = 0x34; buff[1] = 0x23; buff[2] = 0x00; buff[3] = 0xF2; FileStream fs = new FileStream("hex.bin", FileMode.Create, FileAccess.ReadWrite); BinaryWriter bw = new BinaryWriter(fs); bw.Write(buff); bw.Close(); Console.WriteLine("Written to file : hex.bin");
I would like to read a hex number (lets just say 342300F2) from a text file and encode that same hex number to a binary file. I cant work out how to process the text into binaray. Any ideas?




Reply With Quote