I have the following code. As far as I am concerned, I think each time I input a character (such as 'b') I got a 'b' and 'LF' from terminal.

But if I set VERASE, which means "Causes the terminal driver to delete the last character on the line", The 'LF' should be deleted by the terminal. But it's not the truth.

What's wrong? How to demonstrate the affect of VERASE if it's set?


#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <assert.h>


int main()
{
char str[10] = {0};
char c;
int rlt;
FILE* in;
struct termios attr;

if(!isatty(fileno(stdout)))
{
assert(0);
}
in = fopen("/dev/tty", "r");


tcgetattr(fileno(in), &attr);
attr.c_cc[VERASE] = 1;
rlt = tcsetattr(fileno(in), TCSANOW, &attr);

do{
puts("input char");
c = getchar();
putchar(c);
}while(c!='q');
}