Jump to content

PHP/NCURSES problem


xavier_r

Recommended Posts

OK... so i have this code... in PHP using Ncurses...

 

 

while(1)

{

    ...

    display_time()

    ...

    ncurses_getch($lower_main_window) //wait for pressing key

    ...

    ...

    ...

}

 

In this Ncurse app, I want to display changing time continously(real time)... whether or not the user presses a key...

But in my code... The program has to wait for a key... and so time change is not shown untul the users presses a key...

 

How to solve this?

Link to comment
Share on other sites

<?php


function display_time($scr)
{
        $time = date("H:i:s");
        ncurses_mvwaddstr($scr,25,75,$time);
        ncurses_wrefresh($scr);
}
$cur = ncurses_init();

$fs = ncurses_newwin(0,0,0,0);

while (1) {

        display_time($fs);

}
?>

 

you just need to get ride of the ncurses_getch() call

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.