lists.zerezo.com
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
***BOGO*** Re: [Mingw-users] ANSI escape sequences problem
- Date: Thu, 26 Jun 2008 08:30:15 +0200
- From: Bengt Werstén <Bengt.Wersten@xxxxxxxx>
- Subject: ***BOGO*** Re: [Mingw-users] ANSI escape sequences problem
Hi,
Perfect, Thanks a million man. Now it works just they way I want it. To sum up what was required to be able to use ascii escape sequences in MinGW as both input and output to create a custom way of reading user input without buffering:
* Use rxvt instead of bash.
* Disbale local echo in rxvt before application start with:
stty raw -echo
* Disable stdin buffering and enter binary mode:
setvbuf(stdin, NULL, _IONBF, 0);
_setmode(_fileno(stdin), _O_BINARY);
* Use fgetc to read separate characters.
Yet again, thanks for all help.
Best regards,
Bengt Werstén
-----Original Message-----
From: mingw-users-bounces@xxxxxxxxxxxxxxxxxxxxx [mailto:mingw-users-bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf Of Brian Dessent
Sent: den 25 juni 2008 21:28
To: MinGW Users List
Subject: Re: [Mingw-users] ANSI escape sequences problem
Bengt Werstén wrote:
> Now it almost works perfect, even the left and right arrows are sent as the correct escape sequences when read with getc. Only one very annoying problem left, when Enter is pressed nothing is read by getc. When the next key is pressed the value 13 (fine but too late) is read but not the key I pressed. Pressing the third key will get both the second and the third key read by getc.
Hmm, that sounds like the C runtime is operating in textmode on that fd,
where it has to scan for the CR/LF sequence to convert to LF. You
should make sure the fd is in binary mode, e.g. by _setmode (fd,
_O_BINARY).
Brian
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users