Subject: C#: EOF using StreamReader
Posted By: shazia1 Post Date: 8/16/2005 4:25:10 AM
i m using StreamReader to read lines from my file
i want to end reading till EOF is reached.
Here is my code:

using (StreamReader sr = new StreamReader("TestFile.txt"))
{
    String line;
    while ((line = sr.ReadLine()) != null)
    {
        Console.WriteLine(line);
    }
}

Now the problem is that if there are any  consecutive newlines in my file, the reader stops reading assuming that its end of file.
How to cope up wid dis problem?

Thanks,
Shazia.


Go to topic 33783

Return to index page 489
Return to index page 488
Return to index page 487
Return to index page 486
Return to index page 485
Return to index page 484
Return to index page 483
Return to index page 482
Return to index page 481
Return to index page 480