Return to Snippet

Revision: 51543
at September 28, 2011 03:04 by kirilstanoev


Updated Code
// create reader & open file
TextReader tr = new StreamReader("SomeFile.txt");

string line = "EMPTY LINE";
while ((line = tr.ReadLine()) != null)
{
    Console.WriteLine(line);
}

// close the stream
tr.Close();

Revision: 51542
at September 28, 2011 03:04 by kirilstanoev


Initial Code
// create reader & open file
            TextReader tr = new StreamReader("SomeFile.txt");

            string line = "EMPTY LINE";
            while ((line = tr.ReadLine()) != null)
            {
                Console.WriteLine(line);
            }

            // close the stream
            tr.Close();

Initial URL
http://msdn.microsoft.com/en-us/library/aa287535%28v=vs.71%29.aspx

Initial Description

                                

Initial Title
Reading a Text File Line by Line

Initial Tags

                                

Initial Language
C#