Results 1 to 4 of 4

Thread: Programming C Question

  1. #1
    Junior Member
    Join Date
    Oct 2002
    Posts
    4

    Post Programming C Question

    Hi all,

    This is the only part of the forum where I thought my question would fit in. I am new to programming in C and c++. Everytime I go to run my programs in windows xp they open and close out really fast. The only way I could stop that was by adding a pause in there and adding a pause to every one of my programs gets really tedious (at least to me it does) Is there any command in ms-dos that could keep open my program without windows xp closing it so fast. Its just frustrating not being able to see the output of the program.

    Thanks for your help

    RiVa

  2. #2
    Senior Member tampabay420's Avatar
    Join Date
    Aug 2002
    Posts
    953
    bacause, there is no pause at the end of your program...
    either stick an inkey type statement at the end, or you can set windows to not close DOS program's after their done...

    [edit]
    You can use getc() or getchar() from stdio.h
    You can also have a delay instead Sleep(milliseconds);
    You can also run the exe from the prompt and it will not close the window
    [/edit]
    yeah, I\'m gonna need that by friday...

  3. #3
    Senior Member
    Join Date
    Jul 2001
    Posts
    420
    TampaBay give a great suggestion you can also open a console window (start-run-cmd) and go to the directory where the program is (visual studio default path is C:\Program Files\Microsoft Visual Studio\MyProjects\<projectName>\debug) and run the executable.

    Cheers,

    -D
    If you spend more on coffee than on IT security, you will be hacked. What\'s more, you deserve to be hacked.
    -- former White House cybersecurity adviser Richard Clarke

  4. #4
    Junior Member
    Join Date
    Oct 2002
    Posts
    4
    thanks for your help guys :-)

    RiVa

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •