Enviado em 02/11/2018 - 12:02h
Bom dia pessoal,#ifndef TECLAS_H
#define TECLAS_H
int mygetch(void);
#endif
#include "teclas.h"
#include <termios.h>
#include <unistd.h>
int mygetch(void)
{
struct termios oldt,newt;
int ch;
tcgetattr( STDIN_FILENO, &oldt );
newt = oldt;
newt.c_lflag &= ~( ICANON | ECHO );
tcsetattr( STDIN_FILENO, TCSANOW, &newt );
ch = getchar();
tcsetattr( STDIN_FILENO, TCSANOW, &oldt );
return ch;
}
#include <stdio.h>
#include "teclas.h"
int main()
{
int tec;
printf("\nPRESSIONE: ...\n");
do
{
tec = mygetch();
switch(tec)
{
case 1:
printf("\n digito 1\n");
break;
case 2:
printf("\n digito 2\n");
break;
case 3:
printf("\n digito 3\n");
break;
}
}while(tec != 27);
return 0;
}
Conciliando ZRAM Swap com Swap em arquivo ou partição
Servidor de Backup com Ubuntu Server 24.04 LTS, RAID e Duplicati (Dell PowerEdge T420)
Visualizar câmeras IP ONVIF no Linux sem necessidade de instalar aplicativos
Dicas para encontrar games Indies diferentes e criativos
Proteja seu Linux Mint com o Timeshift: Restaure o sistema mesmo que ele não inicie!
Instalar driver Nvidia no Debian 13
Redimensionando, espelhando, convertendo e rotacionando imagens com script
Ajuda com o Debian 13 - Video hibrido geforce 940 mx Wayland OFF (4)
Problema com impressoras de rede (1)
Rust é o "C da nossa geração"? (10)