2013-05-29 30 views

回答

1

deleteln()刪除該行並將其餘文本向上移動。 clrtoeol()將清除到當前行的末尾。

您需要使用int move(int y, int x)將光標定位在每條最上面兩行的開頭,然後撥打clrtoeol()

clear()清除整個窗口

1

parkydr說:「clrtoeol()清除到當前行的結尾。」

這幾乎是正確的。 clrtoeol()從您光標清除到當前行的末尾。所以如果你的光標不在行首,那麼它不會清除整行。

下面是一個例子:

int y, x;   // to store where you are 
getyx(stdscr, y, x); // save current pos 
move(0, 0);   // go to the beginning of the first line 
clrtoeol();   // clear the line 
move(1, 0);   // go to the beginning of the second line 
clrtoeol();   // clear the line 
move(y, x);   // move back to where you were