0

i would like to know if there is a way to read a string continuously on the console and detect the backspace key if the user erase a character. Let me explain a little bit more, for example:

  1. Write a word on the console: "Word" So i got the string. And i can use all the methods from string like access to the characters item[0] = "W" or item.length()
  2. The user press the backspace key and know my string item will have "Wor"
  3. If the user put another letter the string is updated "Worrtw"

I using this for recommend words according what user is typing. I posting this beacause i really don't found anything usefull at the moment for the keywords or something about the string.

JBentley
  • 6,099
  • 5
  • 37
  • 72
Ellebkey
  • 2,201
  • 3
  • 22
  • 31
  • 2
    You'll need to look up [canonical and non-canonical terminal I/O](https://stackoverflow.com/questions/358342/canonical-vs-non-canonical-terminal-input/358381#358381) — and perhaps libraries that help support it, such as the `ncurses` library. – Jonathan Leffler Nov 30 '15 at 03:47
  • A second suggestion for `ncurses`. But you're not going to have fun ;). – kmac Nov 30 '15 at 06:52
  • Well i should take a look on that "funny" library then. Thanks – Ellebkey Nov 30 '15 at 18:51

0 Answers0