[Gambas-user] Application_Read

Benoît Minisini gambas at ...1...
Thu Jun 3 10:44:11 CEST 2010


> Hi Benoit, hi all
> 
> I tried to do as you said using Application_Read() for catching
> keystrokes in a console program, but sorry, I just don't know how to
> receive the key into a string variable to be able to process it any
> further.

Read the standard input with the Read instruction:

Public Application_Read()

  Dim Keys As String

  ' Read up to (so the negative sign) 256 characters from the standard input
  Keys = Read -256
  ...

End

> 
> What I found out is that the mere existence of an Application_Read()
> keeps the program from falling out of FMain() and terminating by just
> looping within (or into) Application_Read(). 

If you don't read the standard input, the Application_Read will be called 
again and again, as there is always something to read!

> Every key is mirrored by
> the console (i. e. the program maybe even doesn't receive anything, or
> standard input is directly connected to standard output). The program
> can still be terminated by Ctrl-C.
> 

Read (again?) the mail I wrote about a component based on the ncurses library. 
Only that library has all the features to deal with terminal output and "real-
time" terminal input.

And I suggest you read all documentation you find on Linux/Unix terminal 
management, and look at the "stty" shell command.

Regards,

-- 
Benoît Minisini




More information about the User mailing list