sw = new StreamWriter(filepath , false, encode);
sw.Write(str);
sw.Flush();程序是在第一句报错的,其中filepath值为:@"E:\mybbs\web\html\15.htm"我是想把str字符串内的数据生成一个15.htm文件报这个错误,是程序问题,还是写文件写不进去?
sw.Write(str);
sw.Flush();程序是在第一句报错的,其中filepath值为:@"E:\mybbs\web\html\15.htm"我是想把str字符串内的数据生成一个15.htm文件报这个错误,是程序问题,还是写文件写不进去?
using(FileStream fs = new FileStream(filepath, FileMode.Create, FileAccess.Write))
{
using(StreamWriter sw = new StreamWriter(fs))
{
sw.Write(str);
sw.Flush();
}
}