also @ TechSpot: Congress pressures Google on Glass privacy concerns

win xp dos?

Discussion in 'Windows OS' started by scopexmoh, Oct 18, 2003.

  1. scopexmoh Newcomer, in training Posts: 20

    hello....i am starting to learn to program in c++ and have a small question...it seems that when i write a simple program, such as the hello world.....i dont have time to see the message when running the program....the dos window pops up and then closes really fast....i also noticed this when tryin to run dos commands from the sys32 folder..is this a result of the dos change in win xp? is there anyway i can get these boxes to not automaticlly close?
  2. Didou Bowtie extraordinair! Posts: 5,898

    The reason it closes so fast is because the system opens a command prompt, exectutes the program & exits straight away. If you want to see you programs output, at the end of the intructions, add a getch();.

    That way, the programm will wait for you to hit a key on the keyboard before exiting.

    If you want to launch a command prompt from which to execute your programs, got to Start Menu -> Run -> cmd
  3. scopexmoh Newcomer, in training Posts: 20

    is that at the end of the source code.....? or after the command?? explain please.....thanks for your help!
  4. Didou Bowtie extraordinair! Posts: 5,898

    Like this :

    #include "stdafx.h"
    #include "conio.h" //required to use getch()

    int main(int argc, char* argv[])
    {
    printf("Hello World!\n");
    getch(); //this is where you add it
    return 0;
    }


    PS This was done on MSVC 6
  5. scopexmoh Newcomer, in training Posts: 20

    o ok ....well thats a pain......o well.....that was never explained in my c course...any one know of a good up to date online c training or tuts?