CodePudding user response:
File. Read readalltext, File. Writealltext writesCodePudding user response:
And winform it doesn't matter, with the System. IO under this namespace class can do itCodePudding user response:
Using reader As StreamReader=File. OpenText (" d: \ a.t xt ")Dim As String=s reader. ReadToEnd ()
The End Using
CodePudding user response:
Read the file:Public void Read (string path)
{
}
CodePudding user response:
//read
Public void Read (string path)
{
StreamReader sr=new StreamReader ();
The string line;
The line=sr. ReadLine ();
While (the line!=null)
{
Console. WriteLine (line. The ToString ());
}
}
//write
Public void a Write (string path, string context)
{
FileStream fs=new FileStream (path, FileMode. Create);
Byte [] data=https://bbs.csdn.net/topics/System.Text.Encoding.Default.GetBytes (context);
Fs. Write (data, 0, the data length);
Fs. Flush ();
fs.Close();
}