[1].StreamWriter variable declaration
public static System.IO.StreamWriter streamWriter;
[2].initialize of the variable
streamWriter = new System.IO.StreamWriter("filePath", false, System.Text.Encoding.GetEncoding("gb2312"));
[3].Write a string to the stream
streamWriter.Write(str);
[4].Clears all buffers for the current writer and cased any buffered data to be writen to the underlying stream
public static System.IO.StreamWriter streamWriter;
[2].initialize of the variable
streamWriter = new System.IO.StreamWriter("filePath", false, System.Text.Encoding.GetEncoding("gb2312"));
[3].Write a string to the stream
streamWriter.Write(str);
[4].Clears all buffers for the current writer and cased any buffered data to be writen to the underlying stream
streamWriter.Flush();
[5].Reclamation of the writer when no more use it
if (streamWriter != null)
{
streamWriter.Close();
}