ncurses

Dieses ist ein englischer Text aus meinem Archiv. Er ist möglicherweise nicht mehr aktuell, aber ich dachte dass er erhalten werden sollte.

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 --------------------------------------+
|<?php                                                   |
|                                                        |
|    /* start me with "allkeys" as arument to use all key>
|                                                        |
|    // 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.