Finding out if an engine is opened in a console.
Posted: 03 Jul 2005, 00:27
Is there a way (in both Unix and Win32) to find out whether stdin is through a console or if it is redirected to a pipe?
Discussions (not only) about Xboard/Winboard, Computer Chess and Chess Programming
http://www.open-aurec.com/wbforum/
HANDLE hInput = GetStdHandle( STD_INPUT_HANDLE );
DWORD dwConsoleMode;
bool isInputPipe = false;
if( ! GetConsoleMode( hInput, &dwConsoleMode ) ) {
isInputPipe = PeekNamedPipe( hInput, 0, 0, 0, &dwAvailable, 0 ) != 0;
}