有谁知道如何将一个字节数组写成文件???

mrlining 2003-09-30 09:54:26
我有一个Byte[] a 形变量,如何将a写在一个文件里,最后一次写成,不要用循环。
另外,如何得到一个网址,如http://www.microsoft.com/index.html 如何将它下载到本地硬盘。
...全文
38 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xixigongzhu 2003-09-30
  • 打赏
  • 举报
回复
WebClient client = new WebClient();
client.BaseAddress = "http://www.microsoft.com";
FileStream fs = File.Create("c:\\index.html");
fs.Close();
client.DownloadFile("index.html","c:\\index.html");
xixigongzhu 2003-09-30
  • 打赏
  • 举报
回复
FileStream fs = new FileStream("test.txt");
fs.Write(a, 0, a.Length);
fs.Flush();
fs.Close();

110,499

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧