Skip to content

Instantly share code, notes, and snippets.

@bayasdev
Created June 9, 2020 18:12
Show Gist options
  • Save bayasdev/b792df905b91502867331dee3399c043 to your computer and use it in GitHub Desktop.
Save bayasdev/b792df905b91502867331dee3399c043 to your computer and use it in GitHub Desktop.
Alternativa multiplataforma a system("pause") en C
//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