Solved

Escape Code

Posted on 1998-10-01
10
290 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
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…
The goal of this video is to provide viewers with basic examples to understand recursion 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.

777 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