Article View: es.comp.os.linux.programacion
Article #13215Re: Pulsar una tecla
From: Ángel Suárez Rivero
Date: Sat, 17 Mar 2001 06:33
Date: Sat, 17 Mar 2001 06:33
55 lines
2479 bytes
2479 bytes
jperro wrote:
>
> Gracias por tu veloz respuesta �se podr�a hacer sin usar esa librer�a?
> (mejor usando las normales 'st...'), es que ya que he conseguido colores y
> locate sin usarla...
Prueba con termio
---------------------------------------------------------------------------
/* CUIDADIN CON TERMIO Y TERMIOS QUE POR LO VISTO FUNCIONAN DIFERENTE */
#include <termio.h>
#include <stdio.h>
static struct termio tbufsave;
char a_getch(void)
{
char c;
struct termio tbuf;
if ( ioctl(0, TCGETA, &tbuf) == -1)
perror( "TCGETA" );
tbufsave = tbuf;
tbuf.c_iflag &= ~( INLCR | ICRNL | IUCLC | ISTRIP | IXON | BRKINT );
tbuf.c_oflag &= ~OPOST;
tbuf.c_lflag &= ~( ICANON | ISIG | ECHO );
tbuf.c_cc[4] = 0;
tbuf.c_cc[5] = 255;
if ( ioctl(0,TCSETAF, &tbuf ) == -1 )
perror("TCSETAF");
c=getchar();
if( ioctl( 0, TCSETAF,&tbufsave) == -1)
perror( "ioctl" );
return(c);
}
int main(void)
{
a_getch();
return 0;
}
-----------------------------------------------------------------------------------
Saludos
--
�������������������������������������������
| @NGEL srangel@teleline.es Citius22 |
�������������������������������������������
Technical Details
Message-ID:
<3AB30530.B9EBA919@teleline.es>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!213-99-68-250.uc.nombres.ttd.ES!not-for-mailReferences:
<98t62i$33b$1@mercurio.cica.es> <Pine.SOL.4.10.10103161439080.28469-100000@gofio> <98t957$37n$1@mercurio.cica.es>Show Full Headers
Complete Article Headers
X-Google-Language: PORTUGUESE,ASCII X-Google-Thread: f86c8,570817d181c7d0a6,start X-Google-Attributes: gidf86c8,public X-Google-ArrivalTime: 2001-03-16 22:34:04 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!213-99-68-250.uc.nombres.ttd.ES!not-for-mail From: Ángel Suárez Rivero <srangel@teleline.es> Newsgroups: es.comp.os.linux.programacion Subject: Re: Pulsar una tecla Date: Sat, 17 Mar 2001 06:33:20 +0000 Lines: 55 Message-ID: <3AB30530.B9EBA919@teleline.es> References: <98t62i$33b$1@mercurio.cica.es> <Pine.SOL.4.10.10103161439080.28469-100000@gofio> <98t957$37n$1@mercurio.cica.es> NNTP-Posting-Host: 213-99-68-250.uc.nombres.ttd.es (213.99.68.250) Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: fu-berlin.de 984810648 3838667 213.99.68.250 (16 [79850]) X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.17 i686) X-Accept-Language: en