FileStream fs; StreamWriter sw;string RootPath = @"C:Advantech" + "\tempData\" + "data.txt"; fs=new FileStream(RoothPath,FileMode.Creat,FileAccess.Write)//绝对地址 sw=new StreamWriter(fs); sw.Write(data); sw.Close(); fs.Close();