帮帮忙啊!!!C# 的字符串写入文件 怎么实现????
展开全部
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Drawing;
using System.IO;
下面定义的静态函数把字符串s写入文件路径+文件名为fn的文件中去.
public static void SaveFile(string fn , string s)
{
using (StreamWriter savefile = new StreamWriter(fn))
{
savefile.WriteLine(s);
}
}
public static void SaveFile(string s)
{
using (StreamWriter savefile = new StreamWriter(SysFileName))
{
savefile.WriteLine(s);
}
}
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Drawing;
using System.IO;
下面定义的静态函数把字符串s写入文件路径+文件名为fn的文件中去.
public static void SaveFile(string fn , string s)
{
using (StreamWriter savefile = new StreamWriter(fn))
{
savefile.WriteLine(s);
}
}
public static void SaveFile(string s)
{
using (StreamWriter savefile = new StreamWriter(SysFileName))
{
savefile.WriteLine(s);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询