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文件中
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章