System.in.read();类似C++中的getch()

解决方案 »

  1.   

    console.In.read();经核实应为以上语句。谢谢
      

  2.   

    using System.IO
    using (StreamWriter sw = new StreamWriter("TestFile.txt")) 
            {
                // Add some text to the file.
                sw.Write("This is the ");
                sw.WriteLine("header for the file.");
                sw.WriteLine("-------------------");
                // Arbitrary objects can also be written to the file.
                sw.Write("The date is: ");
                sw.WriteLine(DateTime.Now);
            }
      

  3.   

    using System;
    using System.IO;
    public class TextToFile {
       private const string FILE_NAME = "MyFile.txt";
       public static void Main(String[] args) {
          if (File.Exists(FILE_NAME)) {
             return;
          }
          StreamWriter sr = File.CreateText(FILE_NAME);
          sr.WriteLine ("字符串");
          sr.Close();
       }
    }
      

  4.   

    xixigongzhu(夕夕公主)你的简单,但是无法实现英文中文字符的输入。输出结果:{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fcharset134 \'cb\'ce\'cc\'e5;}}
    \viewkind4\uc1\pard\lang2052\f0\fs18\'ca\'fd\'be\'dd\'b1\'a3\par
    }
      

  5.   

    using System;
    using System.IO;
    public class TextToFile {
       private const string FILE_NAME = "MyFile.txt";
       public static void Main(String[] args) {
          if (File.Exists(FILE_NAME)) {
             return;
          }
          StreamWriter sr = File.CreateText(FILE_NAME);
          sr.WriteLine ("字符串");
          sr.Close();
       }
    }
      

  6.   

    好像不是text to file
    是richTextBox中显示的所有数据saveto file,一次就把所有数据存入事先建立好的文件(dd.txt)中。不知是否说明白。
      

  7.   

    thank u everybody已经找到例子private void button4_Click(object sender, System.EventArgs e)
               


    //public void SaveMyFile()
    {
    // Create a SaveFileDialog to request a path and file name to save to.
    SaveFileDialog saveFile1 = new SaveFileDialog();// Initialize the SaveFileDialog to specify the RTF extension for the file.
    saveFile1.DefaultExt = "*.txt";
    saveFile1.Filter = "TXT Files|*.txt";// Determine if the user selected a file name from the saveFileDialog.
    if(saveFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK 
    &&saveFile1.FileName.Length > 0) 
    {
    // Save the contents of the RichTextBox into the file.

          richTextBox1.SaveFile saveFile1.FileName,RichTextBoxStreamType.PlainText);
    }
    }