- #1
madmike159
Gold Member
- 371
- 0
I started learning C not long ago. Like most people I started with "Hello World". I relised that it closes itself unless you tell it not to.
I have this code
#include <stdio.h>
int main(char *argv[])
{
printf("Hello World!\n");
getchar();
return 0;
}
It makes it close when you press enter. The problem is when you do read input commands like scanf() it closes when you press enter. Does anyone know how I can change this to so it closes when you press something else (like esc, or Ctrl+enter)?
I have this code
#include <stdio.h>
int main(char *argv[])
{
printf("Hello World!\n");
getchar();
return 0;
}
It makes it close when you press enter. The problem is when you do read input commands like scanf() it closes when you press enter. Does anyone know how I can change this to so it closes when you press something else (like esc, or Ctrl+enter)?