Ending a Console.ReadLine() in C#

  • Thread starter Thread starter talljames
  • Start date Start date
T

talljames

Hi all,

Does anyone know how to end a Console.ReadLine() programmically rather
than typing the enter key in C#?

I have tried just setting the class object that contains this line to
null, but unfortunately that doesn't clear it up because it is
waiting for a signal to reactivate itself. I thought that maybe a
could write the equivelant of an Enter key to the console? Not sure
how to do that ie "\r\n"? :?:

thanks in advance.
 
Hi,

You could theoretically send '\r\n' to the process' standard input stream.
 
Thanks guys, sorry for getting back so late. Fixed it with a simple
flag inside a ;; and a Thread.Sleep, which pops out every so often to
check the flag. Works much better and doesn't consume as much
resources and doesn't limit other graphics operations.

cheers
James
 
Back
Top