Results 1 to 7 of 7

Thread: simple question

  1. #1

    Thread Starter
    Lively Member Rickie's Avatar
    Join Date
    Mar 2002
    Location
    Hull, England
    Posts
    83

    simple question

    I'm using K&R C code and the Dev-C compiler. I'm making a DOS console and used this code.....
    #include <stdio.h>

    int main(int argc, char *argv[])

    {
    printf( "Hello, people\n" );
    }

    The program executes but closes after it displays the message, any one know how I keep the program open ?
    Many Thanks
    "I love the silence before the storm it reminds me of Beethoven"

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Various methods. One is adding something to keep the window open, like system("pause") (you need <stdlib.h> for that). I don't like them.
    I prefer opening a console window and call the app from there.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Oh, and by the way: you're in the wrong forum. This is the C# forum, the C/C++ forum is further down the index page.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    i dont understand why ppl who work in c++ can confuse '++' word to '#', and if in play c to now to know that c++ and C# arent the same as c...........something's very wrong
    \m/\m/

  5. #5

    Thread Starter
    Lively Member Rickie's Avatar
    Join Date
    Mar 2002
    Location
    Hull, England
    Posts
    83
    I know the difference between the two c++ is object orientated. I also didn't see the other C forum, I never confused this one with it, so I thought the people in this forum might have the answer (which they did), chow
    "I love the silence before the storm it reminds me of Beethoven"

  6. #6
    Member
    Join Date
    Sep 2002
    Location
    London
    Posts
    63
    you can do a

    getchar();

    which will wait until Enter is pressed.

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Except that I mainly visit the C/C++ forum, so I'm not one of the people from here really.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

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



Click Here to Expand Forum to Full Width