Possible Duplicate:
How can I determine whether Console.Out has been redirected to a file?
How to detect if Console.In (stdin) has been redirected?
Our system is currently using a CursorLeft
function to write over the last thing that was printed onto the console window:
Console.CursorLeft = 0;
This is functionality that is required, so I cannot change it to just print a new line every time.
When redirecting the console to a text file, IOException
occurs. How can I get the log file to either skip displaying these outputs or force it to write everyone of them out?