From: Kees van Veen <cvn@interchain.nl>
To: gnu-win32@cygnus.com
Subject: tty raw mode
Date: Fri, 17 Oct 1997 09:51:00 -0000 [thread overview]
Message-ID: <34477B57.3C07A027@interchain.nl> (raw)
Hi,
A while ago I posted a question about getting the console in raw mode.
In the meantime I found a partially working solution using
GetConsoleMode and
SetConsoleMode.
Here's a piece of code:
#include <stdio.h>
#include <fcntl.h>
#include <windows.h>
main()
{
DWORD dwMode;
HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE);
if (GetConsoleMode(hStdIn, &dwMode) == TRUE)
SetConsoleMode(hStdIn,
dwMode & ~(ENABLE_LINE_INPUT | /* No buffering */
ENABLE_PROCESSED_INPUT |
ENABLE_ECHO_INPUT | /* No echo
*/ ENABLE_WINDOW_INPUT));
for (;;)
{
int c = getchar();
printf("%d <%c>\n", c, c);
}
}
Now all works fine except for two things:
1) getchar() does not distinguish between <CR> and <LF>
2) <LF) produces <CR><LF>
I've also tried a version using ReadConsole(), I've tried _setmode(0,
O_BINARY), but
without any success.
Does any of you have any idea ?
Thanks in advance for your time.
Kees
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
next reply other threads:[~1997-10-17 9:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-10-17 9:51 Kees van Veen [this message]
1997-10-29 8:46 Kees van Veen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=34477B57.3C07A027@interchain.nl \
--to=cvn@interchain.nl \
--cc=gnu-win32@cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).