Solved

Escape Code

Posted on 1998-10-01
10
284 Views
Last Modified: 2010-04-15
If you want to type a backslash you have to do :
printf("\\");
if you want a bell it's \a
a horizontal tab is \t
...
What is the code for ESCAPE.
0
Comment
Question by:pchaloux
10 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1253157
"\033"
0
 
LVL 2

Expert Comment

by:kellyjj
ID: 1253158
the asci value of the escape key is 27 (dec).
0
 
LVL 1

Expert Comment

by:abhinavm
ID: 1253159
I didn't get what actually do you want. If you want to check which key is pressed then you can check it by comparing to 27 (ASCII for Esc). Why else you want a god for Escape?
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1253160
33 is octal - 3*8 + 3 = 24 + 3 = 27
0
 
LVL 1

Expert Comment

by:Bonev
ID: 1253161
You cannot type the Escape character - it does not have graphical representation.

0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:pchaloux
ID: 1253162
Ok guys, I got it, but could you please send an ANSWER so I could grade someone.
You only gave me COMMENTs...
0
 
LVL 9

Accepted Solution

by:
Pacman earned 50 total points
ID: 1253163
pchaloux,

that's all right, the ascii-code for escape is 27 (decimal), and 1B (hex)
so if you want to print it you may write

printf("%c", 27);

or

printf("\033");

ok ?

regards
Pacman
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1253164
The reason everybody was giving comments was that Ozo answered first in a comment and it usually considered good form to let him get the points because of this.

I suspect the reason he gave a comment rather than an answer was he was expecting you to ask a follow up question.

If you want to give Ozo the pts you can reject Pacman's answer and post a comment asking Ozo to lock the Quesiton
0
 

Expert Comment

by:manjucee
ID: 1253165
Hi
      when i tried to print it displays <- (left arrow) sign
printf("%c",27);
     when i tried to read it from keyboard i.e,.
ch=getch();
printf("%c",ch);
it displays the same sign
That mean thats the graphical representation of escape key ?
0
 
LVL 1

Expert Comment

by:Bonev
ID: 1253166
manjucee,
The Escape key is not intended to be shown; if you want to display left arrow, you just look at the ASCII table and pick the arrow from there. It's a coincidence that the image of ASCII code 27 is an arrow. I'm not sure, but I believe that the ASCII table does not defines images for the codes below 32.
The Escape key is a prefix for the "escape sequences" used to control different output devices.

0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now