码迷,mamicode.com
首页 > 其他好文 > 详细

录入数据到指定TXT

时间:2019-02-13 09:22:58      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:指定   tar   nta   lte   inf   show   lin   write   private   

  FileInfo myFile = new FileInfo(@"C:\temp\zxkc.txt");
            StreamWriter sw = myFile.CreateText();

            string[] strs = { zxck1.Text, zxck1.Text, "900" };
            foreach (var s in strs)
            {
                sw.WriteLine(s);
            }
            sw.Close();

 

 

 

  private void Button1_Click(object sender, RoutedEventArgs e)
        {
        
            for (int i = 0; i < 10; i++)
            {
                
               // int i = Convert.ToInt32(zxck1.Text);
            }
            FileInfo myFile = new FileInfo(@"D:\3.txt");
            StreamWriter sw5 = myFile.CreateText();
            int[] charArray = new int[2];
            charArray[0] = 111;
            charArray[1] = 222;
            // initialize these characters 
         

            string[] strs = { "Good Morning!", "Good Afternoon!" };
            File.WriteAllLines(@"d:\4.txt", strs);
            File.WriteAllLines(@"d:\4.txt", strs, Encoding.ASCII);

            string[] strs1 = File.ReadAllLines(@"d:\4.txt");
            
            MessageBox.Show(strs1[0], "系统提示");
            //string str2 = File.ReadAllText(@"c:\1.txt", Encoding.ASCII);
            string str1 = "Good Morning!"; File.WriteAllText(@"d:\2.txt", str1);
            File.WriteAllText(@"d:\2.txt", str1, Encoding.ASCII);
            //MessageBox.Show(str2, "系统提示");

        }

 

录入数据到指定TXT

标签:指定   tar   nta   lte   inf   show   lin   write   private   

原文地址:https://www.cnblogs.com/chenlinghao/p/10367967.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!