I’ve working on this problem where I need to assign a character to a become the delete key in Linux with termios. I’ve looked up resources and it seems like everyone is doing it this way but for some reason I cannot get it to work.
So I am trying to bind the ‘q’ character to become the new delete key. This is what I have. I am assigning the ‘q’ character be the new backspace but when I compile and run ‘q’ doesn’t delete anything.
#include <stdio.h>
#include <termios.h>
int main()
{
struct termios err;
err.c_cc[VERASE] = 'q';
return 0;
}
Advertisement
Answer
... struct termios err; tcgetattr(0, &err); err.c_cc[VERASE] = 'q'; tcsetattr(0, TCSANOW, &err); ...