ncurses

This text is from my arcives. It may be out of date, but I thought it should be preserved.

This is an example how to use the ncurses library.
It displays a (big) text in a scrollable window.
Read the manual within the source.
It will look like the demo below.
Comments, suggestions? Mail me. View the source
Download the source
+- ncurses example --------------------------------------+
|
|                                                        |
|    // read this file as text                           |
|    $text = file($_SERVER['PATH_TRANSLATED']);          |
|                                                        |
|    // strip off any whitespaces (space, newline, ...) a>
|    // and replace tabs by 4 spaces                     |
|    foreach($text AS $k=>$v)                            |
|        if(preg_match('/^(.*?)\s*$/', strtr($v, array("\>
|            $text[$k] = $r[1];                          |
|                                                        |
|    // question                                         |
|    $question = array(                                  |
|        ' This is an more complex example for ncurses', |
+- line 1-16/202 ----------------------------------------+
+--------------------------------------------------------+
| This is an more complex example for ncurses            |
| Use the arrow keys to scroll / ESC or Q to exit        |
+--------------------------------------------------------+

0 Responses to “ncurses”


Comments are currently closed.