Results 1 to 5 of 5

Thread: how not to show the "press any key to continue" in visual C++

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Posts
    1

    how not to show the "press any key to continue" in visual C++

    Hi i would like to ask if there is a way to get rid of the message "press any key to continue" after you run a c++ program ?? thanks!!

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    It only appears when you run it from the IDE, because VC runs another program which runs yours, then puts up the message.

    It doesn't add any extra code to your program to do it - run it from a command.com/cmd.exe prompt to see It does it so that you don't lose the output straight away.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    Addicted Member kikelinus's Avatar
    Join Date
    Nov 2000
    Posts
    219
    you can also put the following at the end of you program:
    Code:
    cin >> whatever;
    which basically pauses the program, waiting for something to be written.


  4. #4
    tbarnette
    Guest
    I think there's at least two ways to run the module from within VC++, but I think only one of them does that.

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Originally posted by tbarnette
    I think there's at least two ways to run the module from within VC++, but I think only one of them does that.
    Running it through the debugger won't give you that, but it does run a bit slower and certain things act differently (esp. when your program dies ).

    In short - F5 for debugger and no prompt. Ctrl-F5 for no debugger and a prompt
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width