downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

ncurses_clear> <ncurses_can_change_color
Last updated: Fri, 14 Aug 2009

view this page in

ncurses_cbreak

(PHP 4 >= 4.0.7, PHP 5 < 5.3.0, PECL ncurses >= 1.0.0)

ncurses_cbreakChange la bufferisation d'entrée

Description

bool ncurses_cbreak ( void )
Avertissement

Cette fonction est EXPERIMENTALE. Cela signifie que le comportement de cette fonction, son nom et, concrètement, TOUT ce qui est documenté ici peut changer dans un futur proche, SANS PREAVIS ! Soyez-en conscient, et utilisez cette fonction à vos risques et périls.

Désactive la bufferisation de ligne, et le traitement des caractères (les interruptions et le flux de caractères de contrôle sont inchangés), rendant les caractères tapés par l'utilisateur directement accessibles au programme.

Valeurs de retour

Retourne TRUE en cas de succès, et NCURSES_ERR en cas d'erreur.

Voir aussi



add a note add a note User Contributed Notes
ncurses_cbreak
php at kormoc dot com
28-Nov-2005 05:16
re satoru's post,
While it's not using cbreak, it sorta is an example. The only difference between raw and cbreak is how control keys are delt with.

Quoted from the ncurses_programming_howto:
Normally the terminal driver buffers the characters a user types until a new line or carriage return is encountered. But most programs require that the characters be available as soon as the user types them. The above two functions are used to disable line buffering. The difference between these two functions is in the way control characters like suspend (CTRL-Z), interrupt and quit (CTRL-C) are passed to the program. In the raw() mode these characters are directly passed to the program without generating a signal. In the cbreak() mode these control characters are interpreted as any other character by the terminal driver.
satoru
06-Nov-2005 07:14
<?php
 
/**************************************
  [WARNING!]
  Your terminal may be uncontrollable.

  [HOW TO EXIT]
  Push space key to terminate raw mode.

  [TESTING]
  Tested with FreeBSD5.3R + PHP5.0.5-CLI.
  The option '--with-ncurses' required.
  **************************************/

 
$tty = system("tty");
 
$handle = fopen($tty, "r");
  if (!
$handle)
    exit(
"cannot open $tty.\\n");

  print
"Push space key to terminate.\\n";

 
ncurses_init();
 
ncurses_raw();
  do {
   
$ch = fread($handle, 1);
   
printf('[%d] ', ord($ch));
  } while (
$ch != " " && ord($ch) != 3);
 
ncurses_noraw();
 
ncurses_end();
  print
"\\n";

 
fclose($handle);
?>

ncurses_clear> <ncurses_can_change_color
Last updated: Fri, 14 Aug 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites