NO

Author Topic: Hello.c  (Read 3225 times)

tconejr

  • Guest
Hello.c
« on: August 17, 2007, 12:40:49 PM »
When I double click the EXE created from the Hello.c sample program, the program flashes on screen and then closes.  What's the recommended approach to telling the console window to remain open until the user presses a key?  At my age I'm not quick enough to read the "Hello, world" before the window closes.  :)

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2097
Re: Hello.c
« Reply #1 on: August 17, 2007, 01:09:20 PM »
Wait for a key before to close, to do this add following lines at the end of the function main:
Code: [Select]
  printf("Press <return> to exit.....");
    getchar();
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

tconejr

  • Guest
Re: Hello.c
« Reply #2 on: August 17, 2007, 01:37:07 PM »
Thanks!