From: cvn AT interchain DOT nl (Kees van Veen) Subject: tty raw mode 29 Oct 1997 11:51:14 -0800 Message-ID: <34574466.486C.cygnus.gnu-win32@interchain.nl> Reply-To: cvn AT interchain DOT nl Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: gnu-win32 AT cygnus DOT com Hi, Just for your information: I have managed to sort of get where I wanted to be, i.e. run a console application in raw mode using GetConsoleMode and SetConsoleMode. I use isatty() to find out whether I'm connected to a tty and then call GetConsoleMode() to check whether I'm running on a console. If GetConsoleMode returns FALSE, and isatty() returns TRUE I assume I'm running from a pseudo tty and then there is no problem, because, thanks to the great work of Sergey, Mike Bernson and others, I'm now able to run my application using telnet and all my ioctl() settings work. If I'm running from a console, I use SetConsoleMode to get to a kind of raw mode (see below). This does not avoid LF being interpreted as CR/LF though (sigh), so I switch to the escape sequence for arrow key down when running from a console. One thing that struck me is that when I use getc(stdin) to read from the console CR (13) is always returned as LF (10) whereas using ReadConsole() returns 13 upon CR, even with the SetConsoleMode settings. Cheers, Kees P.S. For those interested in the Get/SetConsoleMode calls: DWORD input_mode, output_mode; if (GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &input_mode)==TRUE) { SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), input_mode & ~( ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_WINDOW_INPUT)); } if (GetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), &output_mode)==TRUE) { SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), output_mode & ~(ENABLE_WRAP_AT_EOL_OUTPUT)); } - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".