[Gambas-user] Is this the correct way to deal with File.In terminal settings?

Benoît Minisini g4mba5 at gmail.com
Thu Mar 14 00:08:28 CET 2019


Le 13/03/2019 à 22:30, Cedron Dawg a écrit :
> I want to shut of canonical and echo, then restore them when done.
> 
> Excerpting from my code, I am doing this:
> =================================================================
> 
> '---- Save the Terminal Settings
>          
>          Dim theSavedTS As TerminalSettings
>          Dim theUpdateTS As TerminalSettings
> 
>          theSavedTS = File.In.Term.GetAttr()

Yes: TerminalSettings is the equivalent of "struct termios".

> 
> '---- Turn Off Canonical and Echo
>          
>          theUpdateTS = theSavedTS.Copy()
> 
>          theUpdateTS.ICANON = False
>          theUpdateTS.ECHO = False
>          
>          File.In.Term.SetAttr(gb.Write, theUpdateTS)

No: SetAttr() is like OS function tcsetattr(). The second argument is 
like its third argument, i.e. a constant among: Term.TCSANOW, 
Term.TCSADRAIN or Term.TCSAFLUSH.

'man tcsetattr' for the details.

-- 
Benoît Minisini


More information about the User mailing list