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

笑着哭i 提交于 2019-12-08 10:50:30

问题


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.


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/7910512/how-to-delete-text-after-getstr-c-ncurses

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!