Re: Uso De Funcionex Externas Hechas En C: Inkeys
El compañero del foro Vuott, me ha pasado otro código "más estilo
gambas" para hacer imitar el funcionamiento de Inkeys:
Library "libc:6"
Public Struct termio
c_iflag As Short
c_oflag As Short
c_cflag As Short
c_lflag As Short
c_line As Byte
c_cc[8] As Byte
End Struct
Private Const STDINFD As Integer = 0
Private Const TCGETA As Integer = 21509
Private Const TCSETA As Integer = 21510
Private Const ICANON As Integer = 2
Private Const ECHO As Integer = 16
' int ioctl (int __fd, unsigned long int __request, ...)
' Perform the I/O control operation specified by REQUEST on FD.
Private Extern ioctl(__fd As Integer, __request As Integer, ter As Termio) As Integer
Public Sub Main()
Dim c As Byte
Dim param_ant As New Termio
Dim params As Termio
Dim fl As File
Print "Presionar una tecla..."
ioctl(STDINFD, TCGETA, param_ant)
params = param_ant
params.c_lflag = params.c_lflag And Not (ICANON Or ECHO)
params.c_cc[4] = 1
ioctl(STDINFD, TCSETA, params)
fl = Open "/proc" &/ CStr(Application.Id) &/ "fd/0"
Read #fl, c
fl.Close
ioctl(STDINFD, TCSETA, param_ant)
Print "Codigo ASCII de la tecla presionada: "; c; " Caracter: "; Chr(c)
End
Gracias Vuott !!!
Saludos