c# 读取txt方法

2021-04-01 11:27

阅读:464

标签:cep   c#   line   方法   pre   close   ons   IV   ade   

string strLine;
            try
            {
       FileStream aFile = new FileStream("Log.txt", FileMode.Open);
                StreamReader sr = new StreamReader(aFile);
                strLine = sr.ReadLine();
         //Read data in line by line 这个兄台看的懂吧~一行一行的读取
                if (strLine != null)
                {
         //     Console.WriteLine(strLine);
        //      string Line = sr.ReadLine();
            MessageBox.Show(strLine);
                }
         sr.Close();
            }
            catch (IOException ex)
            {
                Console.WriteLine("An IOException has been thrown!");
                Console.WriteLine(ex.ToString());
                Console.ReadLine();
                return;
            }

  

c# 读取txt方法

标签:cep   c#   line   方法   pre   close   ons   IV   ade   

原文地址:https://www.cnblogs.com/MagicAsa/p/9239215.html


评论


亲,登录后才可以留言!