File IO Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jack

    #1

    File IO Question

    I am trying to read an old text file with blanks. I am wondering how do I
    loop through each line even if its a blank? I cannot use the code below to
    loop through the file. Also,some of these text files are delimited by a
    space and not always delimited with carriage return. How can I make the
    streamreader read it two lines instead of one?

    while (line = sr.ReadLine() != null)
    {
    ....
    }

    Thanks


  • Jon Skeet [C# MVP]

    #2
    Re: File IO Question

    Jack <spam@hotmail.c om> wrote:[color=blue]
    > I am trying to read an old text file with blanks. I am wondering how do I
    > loop through each line even if its a blank? I cannot use the code below to
    > loop through the file.[/color]

    Why not? What happens if you try? It should work fine.
    [color=blue]
    > Also,some of these text files are delimited by a
    > space and not always delimited with carriage return. How can I make the
    > streamreader read it two lines instead of one?[/color]

    Not sure what you mean by the last sentence - could you explain in more
    detail?

    --
    Jon Skeet - <skeet@pobox.co m>
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    If replying to the group, please do not mail me too

    Comment

    Working...