c, c++에서 문자열 입력받는 것에 관해서 질문 있습니다.

bass1ife의 이미지

#include <iostream>
#include <string>
using namespace std;

int main()
{
  string str;
  cin >> str;
  cout << str << endl;

  return 0;
}

프로그램을 실행시키고 나서 백스페이스를 누르면 왜 "^H"라고 써지나요?
(Ctrl-Backspace 를 누르면 그냥 앞 문자가 지워지네요...)

cdpark의 이미지

tty 설정에서 DEL키(ascii 127번. 혹은 Ctrl-?)가 erase로 설정되어 있는거죠.

shell prompt에서 stty -a 라고 쳐 보세요.