Results 1 to 4 of 4

Thread: Console App Problem?

  1. #1

    Thread Starter
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409

    Unhappy

    I am making a Win32 Console Application and it works fine when i run it from VC++ but in Windows When i double click on the app, it dissapears imediately.
    How Can i fix that.

    Thanks!
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    At the very end of your main() function, put:
    Code:
    system("pause");
    You'll need to have included <stdlib.h> for this to work.
    The best way, though, is to open up a command prompt and run it from there.
    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
    Join Date
    May 2000
    Location
    Grand Rapids, MI
    Posts
    231

    Red face Kinda like the problem I had

    Except I Was trying to make it pause at the end, waiting for a keystroke, I used getCh and also tried kbhit(), but in both instances, the display was blank until I pressed a key, and it would show it then immediatly exit, ( In other words, I think the console couldnt show the display fast enough, and it paused it before the console could show it, then it unpaused and showed when I pressed a key) any insight on how to do the same, or if that system("pause") will have the same behavior?
    -Karl Blessing aka kb244{fastHACK}
    [email protected]

  4. #4
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    Not that I know anything about it.
    But try this before the pause:
    Code:
    cout.flush();
    This should force the Ostream to flush everything to the display.
    Should.
    I think.
    Perhaps.
    Maybe.

    Try.

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