MS DOS Window closes right away!

This is a discussion on MS DOS Window closes right away! within the C++ Programming forums, part of the General Programming Boards category; once i compile the code, and load it, my program or code/whatever, is displayed in the MS DOS window. Then ...

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    2

    MS DOS Window closes right away!

    once i compile the code, and load it, my program or code/whatever, is displayed in the MS DOS window. Then the MS DOS window terminates automatically, right away. Is there anyway i can set the DOS window to stay open. PRESS A KEY TO CONTINUE... maybe?

  2. #2
    Registered User
    Join Date
    Dec 2004
    Posts
    32

  3. #3
    Registered User
    Join Date
    May 2005
    Posts
    2
    thanks a lot, it worked.

  4. #4
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    I suggest using std::cin.get(); AFAIK, it's the most portable way.

    secondly, just kinda nit-picking, it's not really an MS-DOS window... it's actually called a console window, and isn't really DOS unless you're running an older operating system. newer (windows) operating systems don't allow direct access to DOS or even have it at all... for example, windows XP doesn't have any dos at all. instead when you run cmd, you bring up a console that allows you to use a text-based interaction with windows XP.
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  5. #5
    Registered User
    Join Date
    May 2005
    Posts
    50
    or... using namespace std;
    char s

  6. #6
    Registered User
    Join Date
    May 2005
    Posts
    50
    cin >> s

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 09:23 AM
  2. Window scrollbar
    By maxorator in forum Windows Programming
    Replies: 2
    Last Post: 10-07-2005, 01:31 PM
  3. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 11:17 AM
  4. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 03:33 PM
  5. Pong is completed!!!
    By Shamino in forum Game Programming
    Replies: 11
    Last Post: 05-26-2005, 11:50 AM

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