日期:2014-05-17  浏览次数:21467 次

16进制文件里怎么插入换行符?

像这种文件,文件格式是.bump,以字符数组byte[]的形式往文件里存入16进制数,为了区分每次插入的消息,请问怎么在一行插不满的情况下,换行插入到下一行?就是第一条消息和第二条消息能一眼看出来,跪求大神!!!!
我的代码是:
byte[] inMsgData = new byte[68]{
                      0x00 ,0x00 ,0x00, 0x00 ,0x02, 0x04, 0x0b,0x70, 0x00,0x00, 
                      0x26 ,0x00 ,0x00, 0x00, 0x00 ,0x00 ,0x08 ,0x00 ,0x00 ,0x00 ,
                      0x00, 0x00 ,0x04, 0x00, 0x00 ,0x00, 0x02,0x00, 0x00 ,0x00 ,
                      0x88, 0x88, 0x88 ,0x00 ,0x08 ,0x00 ,0x00 ,0x00 ,0x05 ,0x00 ,
                      0x00,0x00, 0x02 ,0x00 ,0x00 ,0x00  ,0x89 ,0x88 ,0x88 ,0x00 ,
                      0x08 ,0x00 ,0x00 ,0x00 ,0x05 ,0x00 ,0x00 ,0x00 ,0x02 ,0x00 ,
                      0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, 0x00, 0x00
              };
 if (File.Exists(@"d:\L1.bump"))
                            {
                                FileStream fileStream = new FileStream(@"d:\L1.bump", FileMode.Append, FileAccess.Write);
                                fileStream.Write(inMsgData, 0, inMsgData.Length);
                                fileStream.Close();
                            }
                            else
                            {
                                System.IO.File.WriteAllBytes(@"d:\L1.bump", inMsgData.ToArray());

                 &n