CTRL(X) in ANSI standard
BALDWIN
mike at whuxl.UUCP
Wed May 8 17:45:44 AEST 1985
> > [use '\^X' instead of CTRL(x) or CTRL('x')]
> As has been said before, the right way to do this is:
> #define BEL '\007'
I was thinking mainly about programs that use curses or otherwise read
characters one at a time and do special things with ctrl chars. E.g.,
switch (c) {
case '\^U':
/* up code */
case '\^D':
/* down code */
Etc. #define's (other than CTRL) just won't do. And the #define for
CTRL moves around, so you have to use #ifndef. Glick.
Also, it is easier to think in terms of ctrl chars rather than their
octal values when dealing with funny terminal sequences. For instance,
the cursor motion sequence on mime's is ^T row col, and using
printf("\^T%c%c", row, col) is a bit more obvious than
printf("\024%c%c", row, col).
Michael Baldwin
AT&T Bell Labs
harpo!whuxl!mike
More information about the Comp.lang.c
mailing list