public static byte[] GetFile(string strFileName)
{
Stream s = new FileStream(strFileName,FileMode.Open);
byte[] buffer = new byte[s.Length];
s.Read(buffer,0,(int)s.Length);
return buffer;
}
上面代码从文件生成了字节数组,然后
怎样把字节数组保存为文件?
public void saveFile(byte[] buffer)
{
Stream s = new FileStream(strFileName, FileMode.Create);
s.Write(buffer, 0, buffer.Length);
s.Flush();
s.Close();
}
{
Stream s = new FileStream(strFileName,FileMode.Open);
byte[] buffer = new byte[s.Length];
s.Read(buffer,0,(int)s.Length);
return buffer;
}
上面代码从文件生成了字节数组,然后
怎样把字节数组保存为文件?
public void saveFile(byte[] buffer)
{
Stream s = new FileStream(strFileName, FileMode.Create);
s.Write(buffer, 0, buffer.Length);
s.Flush();
s.Close();
}