Hi,
I want to you readline on a tcpip data stream but the data is terminated with a 0 1, not a /n, is there a way to change the behaviour of the readline function or must I write my own binary based reader?

thanks
Robert Craven

Re: StreamReader change Readline operation 80 80

I don't think you can change ReadLine to do that. You can use Peek, Read, and a StringBuilder though.

Dim buffer As New StringBuilder

Do While sr.Peek() <> 0
  buffer.Append( Convert.ToChar( sr.Read() ) )
Loop
Re: StreamReader change Readline operation 80 80

Thanks, I appreciate the response and will implement it. I was appalled to see that my original post said "Iwant to you" instead of "I want to use" and further appalled that I can't edit it, but alas, I guess that is the world of technical threads, it would be cheating to change them after the fact.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.