Pausing before exiting function?

This is a discussion on Pausing before exiting function? within the C Programming forums, part of the General Programming Boards category; is there any function that i could use to pause a couple of seconds at the terminal before exiting the ...

  1. #1
    POeT GuY Matus's Avatar
    Join Date
    Feb 2008
    Location
    Bz
    Posts
    235

    Question Pausing before exiting function?

    is there any function that i could use to pause a couple of seconds at the terminal before exiting the program. Say i tell the user do u wish to exit, my function automatically closes the window but i want something that could pause for a little while

  2. #2
    Registered User
    Join Date
    May 2008
    Posts
    87
    Maybe some combination of atexit() and sleep()?

  3. #3
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    or Sleep() if you're on Windows.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  4. #4
    POeT GuY Matus's Avatar
    Join Date
    Feb 2008
    Location
    Bz
    Posts
    235
    Quote Originally Posted by jason_m View Post
    Maybe some combination of atexit() and sleep()?
    Its on this that i wanted to implement it:

    Code:
    while ((choice= getchar())!= EOF)  {
         switch (choice) 
          {
           case 'Y': 
           case 'y':
           main();
           break;
    
           case 'N': 
           case 'n': 
           printf("Thank you for Your Time\n");
           exit(0);
           break;
          
           default: 
           printf("Oooop Sorry Invalid Answer! Please Try Again!!");
           choice;
           break;
          }
        }
    so if the user enters N, i want it to delay for a couple of seconds rather than immediately exiting

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 07:54 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 12:45 PM
  3. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  4. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  5. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21