In my program I work with an input stream and an output stream. These can in pricipal be any kind of streams, but in most cases they are simply the standard input and output in the console. Here is how the streams are initialized:
StreamReader input = null;
StreamWriter output = null;
/* ... */
if (output == null)
{
output = new StreamWriter(Console.OpenStandardOutput());
}
if (input == null)
{
input = new StreamReader(Console.OpenStandardInput());
}
My problem is that the input from the console is always written to the console. I have some special characters that I do not want written to the console. To be more specific I want to use tab to autocomplete for instance.
When googling around the only solution that I found was to use Console.ReadKey(). However, this would ruin my support for streams in general, since streams does not have a similar method.
My question comes down to: Is there any way detach the input stream from the output stream? Alternative ways to solve this are welcome as well.