C#创建目录 写入文本 基础文本操作
创建目录
void CrateDir(string path)
{
System.IO.Directory.CreateDirectory(path);
}
CrateDir(@"C:\windows\aaa");
写入文件
void shuchu(string path,string info)
{
FileStream fs = new FileStream(path, FileMode.Create);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine(info);
sw.Flush();
sw.Close();
fs.Close();
}
shuchu(“C:\windows\a.txt”,"123");
作者:Bychentufeiyang
补充:软件开发 , C# ,