如何从dat文件读出byte() (具体见内容)

来源:百度知道 编辑:UC知道 时间:2024/05/17 04:30:58
我一个API方法的参数是byte[]型

这个参数是直接从一个dat文件读取的(一个BMP图片)

我问了一个人 他告诉我的只是如何读出一个文件流 但是我还是不会读出byte[]

以下是那段读文件流的代码

// 我先是通过选取文件 获得一个DAT文件
FileStream fs2 = File.OpenRead(this.textBox2.Text);

byte[] RectoReportImgs1 = new byte[fs2.Length];

fs2.Read(RectoReportImgs1, 0, RectoReportImgs1.Length);

// 该返回类型应该是一个byte[]型的
objRcgAPI_Param1.RectoReportImgs = RectoReportImgs1;

你的程序不是很全吗?
fs2.Read(RectoReportImgs1, 0, RectoReportImgs1.Length);
这一句就是从fs2读数据到字节数组RectoReportImgs1中啊。

byte [] xx;
System.BitConverter.ToString(xx);

试试