C operates on the txt file for a small example of a clean add operation

  • 2020-05-19 05:36:25
  • OfStack


// the txt empty 
            FileStream stream = File.Open(Adr,FileMode.OpenOrCreate,FileAccess.Write);
            stream.Seek(0, SeekOrigin.Begin);
            stream.SetLength(0);
            stream.Close();
            // to txt Append information inside 
            StreamWriter sw = new StreamWriter(Adr,true,Encoding.GetEncoding("gb2312"));
            sw.WriteLine(str);
            sw.Flush();
            sw.Close();

Related articles: