Created
June 9, 2020 18:12
-
-
Save bayasdev/b792df905b91502867331dee3399c043 to your computer and use it in GitHub Desktop.
Alternativa multiplataforma a system("pause") en C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Pausa la consola pero funciona en cualquier plataforma | |
//Probado en Windows, Linux y https://www.onlinegdb.com/ | |
//prototipo | |
void pausarConsola() | |
//ejemplo del main | |
int main(){ | |
printf("Hola mundo!\n"); | |
pausarConsola(); | |
return 0; | |
} | |
//la funcion como tal | |
void pausarConsola(){ | |
while (getchar() != '\n');//limpia buffer de entrada | |
printf("Presione ENTER para continuar....");//mensaje al usuario | |
getchar();//pausa la consola hasta presionar enter | |
} | |
//disfruten! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment