0

I have been learning to use the ncurses library and I have come across getstr(). I was wondering how you would erase the text from getstr() on the terminal after the value has already been stored in a variable? I have tried to find the answer on google but no luck!

Basically I want it so when the user presses enter the text will be removed from the screen.

Hudson Worden
  • 2,263
  • 8
  • 30
  • 45

2 Answers2

2

Not familiar with ncurses, but have you tried moving the cursor, and then overwriting what was typed in?

Minh
  • 21
  • 2
  • No but I was just thinking about making a window in the terminal that holds like an input area and then once the user presses enter it will store the value into a string and then I will use some clear function on that window. – Hudson Worden Oct 27 '11 at 01:00
2

As far as I know, ncurses has two functions, gotoxy() and getxy(), which let you jump to every position of the screen and tell you where you are located right know.

Jump to the front of the previous line and call clrtobot() to erase everything after the cursor.

Edit:

Since you said that clearing the entire window is an option, you can just call clear() (also part of the ncurses library).

Dennis
  • 14,264
  • 2
  • 48
  • 57