Read last line of text file

后端 未结 6 1513
耶瑟儿~
耶瑟儿~ 2020-11-28 14:26

I need to know how to read the last line of a text file. I need to find the line and then process it into a SQL database... I\'ve been reading around and scouring the web

6条回答
  •  星月不相逢
    2020-11-28 14:44

    string m = "";
    StreamReader r = new StreamReader("file_path");
    while (r.EndOfStream == false)
    {
        m = r.ReadLine();
    }
    Console.WriteLine("{0}\n", m);
    r.Close();
    

提交回复
热议问题