Estoy tratando de crear una función que printf
una determinada cadena si el usuario presiona cualquier botón en el teclado EXCEPTO para mayúsculas P
si el usuario presiona P
entonces romperá el bucle.
Sin embargo, no creo que esté usando _kbhit
y _getch
adecuadamente. Yo uso el número 80 porque ese es el símbolo ASCII para 80… lo siento por cualquier confusión
void activateAlarm(int channelID) {
int key = 0;
while(temperatureChannel[channelID].currentTemperature > temperatureChannel[channelID].highLimit
||temperatureChannel[channelID].currentTemperature < temperatureChannel[channelID].lowLimit) {
beep(350,100);
if (_kbhit()) {
key = _getch();
if(key == 'P');
break;
}
}
}
if (key == 'P'); break;
debería ser más bienif (key == 'P') break;
– mooooooooooooooooooooooo
17 de abril de 2015 a las 6:40