ncurses_cbreak

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

ncurses_cbreak — Switch of input buffering

Описание

bool ncurses_cbreak ( void )
Внимание

Эта функция является ЭКСПЕРИМЕНТАЛЬНОЙ. Поведение этой функции, ее имя и относящаяся к ней документация могут измениться в последующих версиях PHP без уведомления. Используйте эту функцию на свой страх и риск.

Disables line buffering and character processing (interrupt and flow control characters are unaffected), making characters typed by the user immediately available to the program.

Возвращаемые значения

Returns TRUE or NCURSES_ERR if any error occurred.

Смотрите также

Коментарии

Автор:
<?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($handle1);
   
printf('[%d] 'ord($ch));
  } while (
$ch != " " && ord($ch) != 3);
 
ncurses_noraw();
 
ncurses_end();
  print 
"\\n";

 
fclose($handle);
?>
2005-11-06 01:14:52
http://php5.kiev.ua/manual/ru/function.ncurses-cbreak.html
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.
2005-11-28 11:16:14
http://php5.kiev.ua/manual/ru/function.ncurses-cbreak.html

    Поддержать сайт на родительском проекте КГБ