我要读一个二进制文件,比如原二进制为
00 00 27 0A
我用
FileStream RFile = new FileStream(fileName, FileMode.Open, FileAccess.Read);
BinaryReader BRead = new BinaryReader(RFile);int xxx=BRead.ReadInt32();是按照低字节序读出来的xxx=170328064 170328064 为 0x0A270000我想要的是0x0000270A,按照高字节序要怎么读呢?
00 00 27 0A
我用
FileStream RFile = new FileStream(fileName, FileMode.Open, FileAccess.Read);
BinaryReader BRead = new BinaryReader(RFile);int xxx=BRead.ReadInt32();是按照低字节序读出来的xxx=170328064 170328064 为 0x0A270000我想要的是0x0000270A,按照高字节序要怎么读呢?
{
var bt = br.ReadBytes(4);
Array.Reverse(bt);
return BitConverter.ToInt32(bt, 0);
}