如何在 getstr() c++ 之后删除文本恩诅咒
我一直在学习使用 ncurses 库,并且遇到了 getstr()。我想知道在值已经存储在变量中之后如何从终端上的 getstr() 中删除文本?我试图在谷歌上找到答案,但没有运气!
基本上我想要它,所以当用户按下输入键时,文本将从屏幕上删除。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,ncurses有两个函数,
gotoxy()
和getxy()
,它们可以让你跳转到屏幕的每个位置,并告诉你你所在的位置正确知道。跳转到上一行的前面并调用 clrtobot() 来擦除光标之后的所有内容。
编辑:
既然您说过清除整个窗口是一个选项,那么您只需调用
clear()
(也是 ncurses 库的一部分)即可。As far as I know, ncurses has two functions,
gotoxy()
andgetxy()
, 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).不熟悉 ncurses,但是您是否尝试过移动光标,然后覆盖输入的内容?
Not familiar with ncurses, but have you tried moving the cursor, and then overwriting what was typed in?