二进制转换十进制的问题
我是想把一个二进制文件转换成十进制显示在页面中,下面是我的程序,请各位帮忙看看错误在哪里,请帮忙修改,谢谢using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using
public partial class Default5 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
FileStream fs=new FileStream(@"e:\1111.txt",FileMode.Open,FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
int k =0;
byte[] mydata=new byte[4];
for(int g = 1;g< 3 ;g++)//' 列数-1
{
fudian(mydata[k], mydata[k + 1], mydata[k + 2], mydata[k + 3]); //调用函数fudian
k = k + 4 ;//‘四位二进制转换成一位数字
}
}
public void fudian(byte a0, byte a1, byte a2, byte a3)
{
byte[] a = new byte[4];
float Result;
a[0] = a0;
a[1] = a1;
a[2] = a2;
a[3] = a3;
//先用一个临时数组倒序数组A
byte[] B = new byte[4];
for(int i = 0;i<4;i++)
{
B[i] = a[3 - i];
}
CopyMemory (Result, B[0],4) ;
Math.Round(Result, 3);
}
}