Re: how to find that escape key is pressed while taking the string




"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


.



Relevant Pages

  • Re: Eve - displaying ESC?
    ... EVE actually displays ASCII 26 instead of ASCII 27 for the escape, ... Pardon a question out of ignorance, but does EVE also display ASCII ... but when dealing with PCL code the only character I ...
    (comp.os.vms)
  • RfD: Escaped Strings version 4
    ... the S" string can only contain printable characters, ... the S" string cannot contain the '"' character, ... as an escape character for the entry of characters that cannot be ... \b BS (backspace, ASCII 8) ...
    (comp.lang.forth)
  • RfD: Escaped Strings version 4
    ... the S" string can only contain printable characters, ... the S" string cannot contain the '"' character, ... as an escape character for the entry of characters that cannot be ... \b BS (backspace, ASCII 8) ...
    (comp.lang.forth)
  • Re: how to find that escape key is pressed while taking the string
    ... >> how to check escape key is pressed when accepting the string as input. ... >The C language does not see 'keystrokes', it only sees 'streams ... Some character sets, such as ASCII do ...
    (comp.lang.c)
  • Re: how to find that escape key is pressed while taking the string
    ... Some character sets, such as ASCII do ... define an 'escape' character, but pressing an 'escape' key on ... There are no ASCII characters beyond the basic execution set. ...
    (comp.lang.c)