如何在getstr()c ++ ncurses后删除文本 [英] How to delete text after getstr() c++ ncurses

查看:187
本文介绍了如何在getstr()c ++ ncurses后删除文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在学习使用ncurses库,我遇到了getstr()。我想知道如何在该值已经存储在变量后,从终端上的getstr()删除文本?我尝试在google上找到答案,但没有运气!

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!

基本上我想要的,所以当用户按enter键时,文本将从屏幕上删除。 >

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

推荐答案

据我所知,ncurses有两个函数, gotoxy() getxy(),让你跳到屏幕的每个位置,告诉你你在哪里知道。

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.

跳到上一行的前面,调用 clrtobot()擦除光标后的所有内容。

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

修改

由于您说清除整个窗口是一个选项,您只需调用 clear / code>(也是ncurses库的一部分)。

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

这篇关于如何在getstr()c ++ ncurses后删除文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆