Hudson Worden
Hudson Worden

Reputation: 2353

How to delete text after getstr() c++ ncurses

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.

Upvotes: 0

Views: 2343

Answers (2)

Dennis
Dennis

Reputation: 14477

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).

Upvotes: 2

Minh
Minh

Reputation: 21

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

Upvotes: 2

Related Questions