For Programmers: Free Programming Magazines  


Home > Archive > C# > February 2005 > StreamReader









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author StreamReader
jjasonclark@spamless.gmail.com

2005-02-24, 3:58 am

The StreamReader.ReadLine call will end when a "\r\n" pair (or others)
or the end of the stream is reached. Is there a way to tell what ended
the last call to ReadLine?

Example 1: Line 1\r\n^Z
Results in "Line 1" as the return string.

Example 2: Line 1^Z
Results in the same string. "Line 1"

Although the 2 strings results are the same their respective calls to
ReadLine terminated because of different conditions.

What can be done to tell the difference? Or is this beyond the scope
of StreamReader and I would need to create my own implementation?

Thank you,
Jason

joelmartinez@gmail.com

2005-02-24, 3:59 pm

You probably just want to parse through the underlying stream on your
own. That way you can look for the specific characters to denote a
"line".

Joel Martinez
http://www.onetug.org - Orlando .NET User Group
http://www.codecube.net - blog

jjasonclark@spamless.gmail.com wrote:
> The StreamReader.ReadLine call will end when a "\r\n" pair (or

others)
> or the end of the stream is reached. Is there a way to tell what

ended
> the last call to ReadLine?
>
> Example 1: Line 1\r\n^Z
> Results in "Line 1" as the return string.
>
> Example 2: Line 1^Z
> Results in the same string. "Line 1"
>
> Although the 2 strings results are the same their respective calls to
> ReadLine terminated because of different conditions.
>
> What can be done to tell the difference? Or is this beyond the scope
> of StreamReader and I would need to create my own implementation?
>
> Thank you,
> Jason


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com