Solved

Escape Code

Posted on 1998-10-01
10
291 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
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 
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
 

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

828 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