Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

I'm using Dev-C++4............

Options
  • 18-04-2004 6:12pm
    #1
    Registered Users Posts: 3,135 ✭✭✭


    I'm only doing a small C program and alas it compiles and there are no errors, i go to run and it will accept my input but when it gets to the processing bit the dos window closes. What's the story with this ? is it a certain option clicked or unclicked or is it the compiler, can you recommend an easy c compiler that's easy to install.


Comments

  • Registered Users Posts: 6,306 ✭✭✭OfflerCrocGod


    _sleep(10000);
    Stop for 10 secs - otherwise it will close the window super fast:D. Increase/Decrease the number to your pleasure.


  • Closed Accounts Posts: 437 ✭✭casper-


    Or stick a getch() at the very end so you have to press a key to close the window.


  • Registered Users Posts: 1,372 ✭✭✭silverside


    or put in

    system("PAUSE");

    at the end.


  • Registered Users Posts: 3,135 ✭✭✭ronano


    Originally posted by casper-
    Or stick a getch() at the very end so you have to press a key to close the window.

    Thats what i did, still was super annoying tho


  • Closed Accounts Posts: 25,848 ✭✭✭✭Zombrex


    Originally posted by ronano
    Thats what i did, still was super annoying tho
    It is nothing to do with Dev-C++ or C++ for that matter, it is to do with the way Windows handles DOS windows. Windows automatically closes DOS windows when the program that opened them closes.

    If you want to see output from your programs after they have finished (without altering your program) run them from the command line (type "cmd" or "command" into the Run dialog).


  • Advertisement
  • Closed Accounts Posts: 25,848 ✭✭✭✭Zombrex


    Originally posted by ronano
    Thats what i did, still was super annoying tho
    It is nothing to do with Dev-C++ or C++ for that matter, it is to do with the way Windows handles DOS windows. Windows automatically closes DOS windows when the program that opened them closes.

    If you want to see output from your programs after they have finished (without altering your program) run them from the command line (type "cmd" or "command" into the Run dialog in the "Start" menu in Windows).


  • Closed Accounts Posts: 5,564 ✭✭✭Typedef


    When we reach that point, whatever happend will happen again.


  • Registered Users Posts: 3,135 ✭✭✭ronano


    I just got around it by making it so that the program asks me to press enter to close, i've got another problem in that the program runs fine on my dev compiler but when i bring it into compile on the school pc's well it won't recognise the string command, wtf ? i thoughtall compilers had the same commands etc! As of now i'm stuck with putting in a char as opposed to string but that just seems pedantic and annoying.


  • Registered Users Posts: 6,306 ✭✭✭OfflerCrocGod


    Well it depends on the age of the compiler that you are using in College - it could be quite old and therefore not support ANSI C++. The same thing happens to me in Uni; I have complained to the lecturer about Borland 5 and asked if I could use Linux instead and I was told that Linux (g++) is not used in the workforce but on the other hand Borland 5 is. So basically you have to put up with it:(.


  • Registered Users Posts: 2,497 ✭✭✭Nick_oliveri


    Originally posted by Wicknight
    If you want to see output from your programs after they have finished (without altering your program) run them from the command line (type "cmd" or "command" into the Run dialog in the "Start" menu in Windows). [/B]

    Does'nt work for me. Really newbieish Hello world type stuff im trying to run.
    Cant do the _sleep(10000), () or anything because it is'nt ANSI compliant.
    Using Dev-C++ too.


  • Advertisement
Advertisement