如题,先创建一个TXT文件。
再用代码,给这个文件输入内容
。最后保存为别的后缀名?
这该怎么写?用什么控件?
希望详细点,本人某种意义上C#文件方面的小白

解决方案 »

  1.   

    string str = "Hello World!";
    System.IO.File.WriteAllText(@"C:\1.abc",str);
      

  2.   

            public void WriteLog(string val)
            {
                string filepath = string.Format(@"{0}Input\log.Dat", AppDomain.CurrentDomain.SetupInformation.ApplicationBase);            using (StreamWriter sw = File.AppendText(filepath))
                {
                    sw.WriteLine(val);
                }
            }