【问题标题】:ncurses not deleting characterncurses 不删除字符
【发布时间】:2011-05-14 16:35:54
【问题描述】:

好的,我正在使用 ncurses 编写一个(假设是)简单的计数脚本。每次它增加数字时,我都需要它在添加另一个数字之前删除以前的数字,以便它更新而不是追加。

这是我的代码:

<?php

ncurses_init();
$i = 0;
$nStr = "Number: ";
ncurses_addstr($nStr);
ncurses_refresh();
for ($i=0; $i < 100; $i++)
{
    $iLen = strlen($i);
    for ($j=0; $j < $iLen; $j++)
    {
        ncurses_delch();
    }
    ncurses_addstr($i);
    ncurses_refresh();
    sleep(2);
}
ncurses_end();

?>

目前当我运行它时,它的输出如下:Number: 01234[...]

有人知道我的问题出在哪里以及如何解决吗?

【问题讨论】:

    标签: php ncurses


    【解决方案1】:

    ncurses_delch() 转发删除。如果要将光标移回一列,则改为输出\b

    【讨论】:

    • 有整数值吗?
    • 谢谢,它工作得很好。除了现在它带来了一个新问题。但如果我不能解决它,我会在一个新问题中问这个问题。再次感谢
    • 只是让你知道,我的另一个问题,我设法解决了。再次感谢
    猜你喜欢
    • 1970-01-01
    • 2022-12-03
    • 1970-01-01
    • 1970-01-01
    • 2016-06-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多