C# 读取网络txt文件 并写在本地txt文件中
2013-09-27 14:13
393 查看
public void WriteStream() { try { stirng ImagesPath = ImagesPath + "\\2013-09-27.txt"; HttpWebRequest oHttp_Web_Req = (HttpWebRequest)WebRequest.Create("http://tuitui.uzai.com/baiduBosom/index.20130927.txt"); Stream oStream = oHttp_Web_Req.GetResponse().GetResponseStream(); using (StreamReader respStreamReader = new StreamReader(oStream, Encoding.UTF8)) { string line = string.Empty; while ((line = respStreamReader.ReadLine()) != null) { UTF8Encoding utf8 = new UTF8Encoding(false); //写txt文件 using (StreamWriter sw = new StreamWriter(ImagesPath, true, utf8)) { sw.WriteLine(line); } } } } catch (Exception ex) { } }
相关文章推荐
- C# 读取网络txt文件 并写在本地txt文件中
- C# 本地txt文件读取至comboBox下拉列表
- C# 文件读取和写入(UNC(网络共享)/本地文件/url文件)
- C# 本地txt文件读取至comboBox下拉列表
- 【C#】读取和写入本地txt文件
- C#控制台控制台将一个文件夹中的所有txt文件中的数据读取出来
- 初涉C#之读取txt文件并绘制坐标曲线图
- c# 读取txt文件中特定内容后的文字
- JS创建、写入、读取本地文件(txt)
- c#读取txt文件
- C# 读取Txt文件内容
- 下载图片--网络图片下载。(读取网络文件,填充到本地文件。)
- c++调用其它程序的方法,以及读取本地txt文件方法。
- C# 读取txt文件中的内容,插入到数据库中(StreamReader)
- 用URLLoader读取本地txt,xml等格式文件
- 用C#读取txt文件的方法
- C#读写txt文件的两种方法介绍【申明:来源于网络】
- 用C#读取txt文件的方法(转)
- 用C#编程从数据库中读取图片数据导进Excel文件的方法(如何从数据库中读取保存的文件,直接打开,中间不保存到本地)
- C#读取CSV,Excel,Txt文件,删除文件,拷贝文件