Problem keeping Dos Window Open

This is a discussion on Problem keeping Dos Window Open within the C++ Programming forums, part of the General Programming Boards category; I'm having a problem keeping my Dos window open while I add the line cin.get(); before return 0 Where is ...

  1. #1
    Unrege 123
    Guest

    Unhappy Problem keeping Dos Window Open

    I'm having a problem keeping my Dos window open while I add the line
    cin.get();
    before return 0

    Where is my fault please ??

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    Most likely you use cin>> elsewhere in your code and there's a leftover newline when you get to the get() call. The problem isn't your solution, but previous input. The simples solution is to add another call to cin.get() right after the first one.
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    76
    U cud but thats a bit risky instead use the function cin.ignore(1,'\n') to get rid of the new line in the buffer and use get normally.

  4. #4
    Unrege 123
    Guest
    Thanks Guys

    You are really great here !

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. opengl help
    By heat511 in forum Game Programming
    Replies: 4
    Last Post: 04-05-2004, 02:08 AM
  3. dos to window
    By Eavan Hyde in forum Windows Programming
    Replies: 2
    Last Post: 03-18-2004, 01:24 AM
  4. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 11:12 PM
  5. Problem with non-functional window
    By Magos in forum Windows Programming
    Replies: 5
    Last Post: 04-15-2002, 12:32 AM

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