By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,188 Members | 832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,188 IT Pros & Developers. It's quick & easy.

'\x1b'

P: n/a
ESC = '\x1b'
BACKSPACE = '\b'

How can I know (maybe a short program) the full list?
I want to make a menu in C, and I want to use the 'left' 'up' 'down', etc...


Apr 24 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Olaf \"El Blanco\"" <ve******@yahoo.no> wrote:
ESC = '\x1b'
You do not know this...
BACKSPACE = '\b'
....but you do know this.
How can I know (maybe a short program) the full list?
These are guaranteed by the Standard:

\a is alert (whether this means a bleep, a flash, or something else, is
implementation-dependant).
\b is backspace.
\f is form feed.
\n is new line. It is the character which represents a new line in files
opened in text mode.
\r is carriage return.
\t is a horizontal tab. Size depends on the implementation.
\v is a vertical tab, whatever that is on modern devices.
\' is a literal single quote mark.
\" is a literal double quote mark.
\? is a literal question mark (trigrahps, avoidance, ftpo).
\\ is a literal backslash.

\<octal digits> is the character represented by that octal number, and
\x<hex digits> is the character represented by that hexadecimal number.
The only ones of these of which you reliably know the meaning are
\0, \x0, and equivalent, all of which are character 0, the null
character.

\x1b, as you mention above, is the character with hex value 1b, i.e.
decimal 27. This may or may not represent ESC. It is the character point
for ESC in a very common character set; whether this means that your
implementation also transmits it as an Escape, and whether the OS then
does something sensible with it, is up to them. The Standard neither
does nor reasonably can require it.
I want to make a menu in C, and I want to use the 'left' 'up' 'down', etc...


Can't do that portably. However, if you happen to have a character table
lying around for your OS, and that happens to include cursor key keycode
values, _and_ your implementation gives you these keycodes as input from
the keyboard, you may be able to use these.
Note that any function your implementation may give you to get these
codes without pressing Enter afterwards is non-ISO, unportable, and
therefore off-topic here.

Richard
Apr 24 '06 #2

P: n/a
Olaf "El Blanco" wrote:
ESC = '\x1b'
BACKSPACE = '\b'

How can I know (maybe a short program) the full list?
I want to make a menu in C, and I want to use the 'left' 'up' 'down', etc...


This all greatly depends on what terminal you are
using, and is thus off-topic for this group, as is
mentioned in this groups FAQ.

Also, instead of hard-coding for a specific terminal,
you should probably be using some version of the curses
library (look for 'ncurses' for a popular version).

And, 'curses' is also off-topic for this group.

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Apr 26 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.