//写
StreamWriter sw = File.AppendText("log_zd.htm");
string jilu = "http://zhidao.baidu.com/question/" + counter + ".html
";
sw.WriteLine(jilu);
sw.Close();
//读
StreamReader file = new StreamReader("c://标签.txt", Encoding.Default);
//将文本放到数组中
string[] sz = new string[counter];
while ((line = file.ReadLine()) != null)
{
counter1++;
sz[counter1 - 1] = line;
//Console.WriteLine(line);
}
文本的读和写
C#文件读写操作
最新推荐文章于 2022-09-06 15:55:52 发布
本文介绍了使用C#进行文件的基本读写操作,包括读取整个文件内容、追加写入内容以及逐行读取文件等实用技巧。适用于初学者快速上手文件I/O操作。
1万+

被折叠的 条评论
为什么被折叠?



