H
HunterTeam
Unregistered / Unconfirmed
GUEST, unregistred user!
已用下列方法将byte[]中的数据成功转到float[]中,现在的问题是怎么转回来
float[] floatData = new float[3000];
for (int i=0;i <2999;i++)
{
floatData = BitConverter.ToSingle(bBuffer,i*4);
}
转回来时,用如下代码,转得不对:
BinaryFormatter bf = new BinaryFormatter();
MemoryStream m1 = new MemoryStream();
bf.Serialize(m1, myFloat);
byte[] result = m1.ToArray();
前帖http://www.delphibbs.com/delphibbs/dispq.asp?lid=3915161中,
qqjm说用BitConverter.GetBytes(),好象不行,1个float对四个byte,该如何转?
float[] floatData = new float[3000];
for (int i=0;i <2999;i++)
{
floatData = BitConverter.ToSingle(bBuffer,i*4);
}
转回来时,用如下代码,转得不对:
BinaryFormatter bf = new BinaryFormatter();
MemoryStream m1 = new MemoryStream();
bf.Serialize(m1, myFloat);
byte[] result = m1.ToArray();
前帖http://www.delphibbs.com/delphibbs/dispq.asp?lid=3915161中,
qqjm说用BitConverter.GetBytes(),好象不行,1个float对四个byte,该如何转?