CTRL(X) in ANSI standard

Mark Purtill Purtill at MIT-MULTICS.ARPA
Sat May 4 08:30:09 AEST 1985


<Fnord>
Re: mod.std.c, various.

#define CTRL(XX) ( ($XX)[0] & '\037') 

works (I think) in ANSI C.  (For those of you who've forgotten, this
replaces 

#define CTRL(XX) 'XX' & '\037'

I.e., it converts CTRL(A) to '\001', CTRL(B) to '\002' and so forth,
possibly even doing CTRL([) et. al.  (Not having a copy of the ANSI
standard, I'm not sure.)

(Nb: I've tried to post this twice to cbosgd!std-c at BERKELEY.ARPA, but it
has disapeared without a trace both times.  Hence, I'm posting it to
INFO-C.)

       Mark
^.-.^  Purtill at MIT-MULTICS.ARPA    **Insert favorite disclaimer here**
(("))  2-032 MIT Cambrige MA 02139



More information about the Comp.lang.c mailing list