Re: how to find that escape key is pressed while taking the string
- From: "Mike Wahler" <mkwahler@xxxxxxxxxxxx>
- Date: Tue, 22 Nov 2005 00:46:04 GMT
"Walter Roberson" <roberson@xxxxxxxxxxxxxxxxxx> wrote in message
news:dlth26$ls4$1@xxxxxxxxxxxxxxxxxxxxxxxxxx
> In article <_qrgf.597$A23.319@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
> Mike Wahler <mkwahler@xxxxxxxxxxxx> wrote:
>
>>"sudhir" <sudhir.kumar.sharma@xxxxxxxxx> wrote in message
>>news:1132596489.552689.201410@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
>>> how to check escape key is pressed when accepting the string as input.
>
>>The C language does not see 'keystrokes', it only sees 'streams
>>of characters' as input. Some character sets, such as ASCII do
>>define an 'escape' character, but pressing an 'escape' key on
>>a keyboard might or might not insert such a character into C's
>>'standard input stream'. Your best bet is to find a platform
>>specific solution (and ideally isolate it in your code for ease
>>of porting).
>
> Well, since we don't talk much about Unicode or i18n
> (internationalization) here, I don't think we are going -too- far
> astray to admit that ASCII characters beyond the basic execution set
> exist,
I never denied that they do.
>and if we do not insist that someone must head to another newgroup
> if they don't mind the minor portability loss of assuming ASCII
> compatability.
But an implementation can be fully 'ASCII compatible', without
necessitating platform-specific behavior, such as keyboard
interfaces. After all, the ASCII standard makes no requirements
pertaining to keyboards.
Or have I somehow misunderstood whatever point you're
trying to make?
>
>
> I'm not sure I want to see the "portable" equivilent to
>
> #include <stdio.h>
> int main(void) { puts("That's my $0.02 worth!"); return 0; }
The portable equivalent isn't that bad:
Insert #include <locale.h> and one call to 'setlocale()'.
(That is, unless you demand the
current exchange rate taken into account). :-)
-Mike
.
- Follow-Ups:
- Re: how to find that escape key is pressed while taking the string
- From: Mike Wahler
- Re: how to find that escape key is pressed while taking the string
- References:
- how to find that escape key is pressed while taking the string
- From: sudhir
- Re: how to find that escape key is pressed while taking the string
- From: Mike Wahler
- Re: how to find that escape key is pressed while taking the string
- From: Walter Roberson
- how to find that escape key is pressed while taking the string
- Prev by Date: Re: what parallel C language does MIPS Pro C Compiler support?
- Next by Date: Re: how to find that escape key is pressed while taking the string
- Previous by thread: Re: how to find that escape key is pressed while taking the string
- Next by thread: Re: how to find that escape key is pressed while taking the string
- Index(es):
Relevant Pages
|