c – Hex code for Control+Question Mark? – Education Career Blog

I am trying to set the special characters for a serial port in a C program. I am able to find all of the hex codes except the code for ^? (Control + Question Mark) used for erase.

Required settings:

intr = ^C; quit = ^\; erase = ^?; kill = ^X; eof = ^D; eol = <undef>; 
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 5;

Setting special characters:

struct termios newtio;
newtio.c_ccVMIN=1;
newtio.c_ccVTIME=5;
newtio.c_ccVINTR= 0x03;
newtio.c_ccVQUIT = 0x1c;
newtio.c_ccVKILL = 0x18;
newtio.c_ccVEOF = 0x04;
newtio.c_ccVEOL = 0;
newtio.c_ccVEOL2 = 0;
newtio.c_ccVSWTC = 0;
newtio.c_ccVSTART = 0x11;
newtio.c_ccVSTOP = 0x13;
newtio.c_ccVSUSP = 0x1A;
newtio.c_ccVREPRINT = 0x12;
newtio.c_ccVWERASE = 0x17;
newtio.c_ccVLNEXT = 0x16;
newtio.c_ccVDISCARD = 0x0f;

,

$ od -c <<< ^?
0000000 177  \n
0000002
$

So, 0x7f.

,

Looks like it’s 127 decimal. See Wikipedia

,

It’s typically either <- Backspace (0x08) or DEL (0x7f). Since backspace will almost always render as ^H (CTRLH), I would suggest 0x7f is the one to try.

Leave a Comment