C#下载文件
来源:互联网 发布:charles mac 编辑:程序博客网 时间:2024/06/06 12:42
C#一种下载文件的方法
Stream str = client.OpenRead(URLAddress);
StreamReader reader = new StreamReader(str);
byte[] mbyte = new byte[1000000];
int allmybyte = (int)mbyte.Length;
int startmbyte = 0;
while (allmybyte > 0)
{
int m = str.Read(mbyte, startmbyte, allmybyte);
if (m == 0)
break;
startmbyte += m;
allmybyte -= m;
}
reader.Dispose();
str.Dispose();
string path = receivePath + System.IO.Path.GetFileName(URLAddress);
FileStream fstr = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write);
fstr.Write(mbyte, 0, startmbyte);
fstr.Flush();
fstr.Close();
参考:http://www.cnblogs.com/x4646/archive/2013/04/11/3014634.html
0 0
- C#下载文件函数
- c#文件下载问题
- C#文件下载
- c#文件下载
- c#文件下载方法
- c#实现文件下载
- c#下载文件
- c#文件下载,收藏
- c#下载文件代码
- C#下载文件:WebClient
- C# 下载文件
- C# 文件下载
- C# 文件下载
- C# aspx文件下载
- C#下载 .jar文件
- C#文件下载
- C# 直接下载文件
- c# 多线程下载文件
- Python日记——Django模板的渲染
- JAVA8 十大新特性详解
- JFrame设置最大尺寸
- 统计学习方法--条件随机场1
- Learning Python 004 基础的数据类型和变量
- C#下载文件
- VS环境下Debug和Release版本的区别
- openresty 根据参数 重定向请求
- 记录下我使用的UI
- IOS常见的加密方式
- ng $watch
- 思维导图整理
- 96. Unique Binary Search Trees
- 136. Single Number