Thread: Command line programs in Visual Studio

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    124

    Command line programs in Visual Studio

    My question is simple:

    How do you get a command line application made in Visual Studio to keep the command line window open when the application is actually finished running. Normally it just closes the window making it impossible to see output. Within Visual Studio it works fine because VS adds the "Press enter to continue" which blocks. I tried doing something similar with getch() from conio.h and getchar() from stdio.h but neither of those work. If I run the app from within cmd.exe it works fine, but I want it to be a standalone .exe. Anyone know how to do this?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    cprogramming.com's FAQ on How do I get my program to wait for a keypress? may prove useful here.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Jun 2004
    Posts
    124
    Oh, awesome, thanks a lot

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. Problem Compiling Program
    By wco5002 in forum C++ Programming
    Replies: 13
    Last Post: 11-06-2007, 12:56 PM
  4. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 04:49 AM
  5. Erros in Utility Header File
    By silk.odyssey in forum C++ Programming
    Replies: 4
    Last Post: 12-22-2003, 06:17 AM