Wrox Programmer Forums
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 16th, 2005, 04:25 AM
Authorized User
 
Join Date: Jun 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default C#: EOF using StreamReader

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.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Asynchronous reading to console+StreamReader aashish23 C# 1 September 5th, 2007 04:16 AM
StreamReader.ReadToEnd Surre ASP.NET 1.0 and 1.1 Professional 0 March 30th, 2006 07:00 AM
Streamreader question stevec VB.NET 2002/2003 Basics 1 October 10th, 2004 12:49 AM
Looping StreamReader JAtkinson VS.NET 2002/2003 2 April 19th, 2004 04:25 PM
StreamReader Loop [Resolved] JAtkinson VB How-To 0 April 17th, 2004 01:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.