D
Dinsdale
I am writing a small console application that runs fine unless I am re-
directing the output to a file (i.e. c:\ > app.exe >>output.txt) . I
have determined that the issue is caused by the Console.Clear()
function. When piping to a file, the console.clear causes the
following error:
Unhandled Exception: System.IO.IOException: The handle is invalid.
at System.IO.IO__Error.WinIOError(Int32 errorCode, String
maybeFullPath)
at System.Console.Clear()
....
Is there any way to determine where my output is being directed so
that I can skip over the Console.Clear command if I am re-directing
stdOut?
The other side of the error is with input. I prompt the user at one or
two points but if the output is re-directed, I would like to simply
skip the prompt. Again, this would be possible if I can determine
where standard output is going.
Thanks!
Dinsdale
directing the output to a file (i.e. c:\ > app.exe >>output.txt) . I
have determined that the issue is caused by the Console.Clear()
function. When piping to a file, the console.clear causes the
following error:
Unhandled Exception: System.IO.IOException: The handle is invalid.
at System.IO.IO__Error.WinIOError(Int32 errorCode, String
maybeFullPath)
at System.Console.Clear()
....
Is there any way to determine where my output is being directed so
that I can skip over the Console.Clear command if I am re-directing
stdOut?
The other side of the error is with input. I prompt the user at one or
two points but if the output is re-directed, I would like to simply
skip the prompt. Again, this would be possible if I can determine
where standard output is going.
Thanks!
Dinsdale