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

System("PAUSE")?

Options
  • 21-09-2009 1:17pm
    #1
    Registered Users Posts: 2,379 ✭✭✭


    Hi guys,

    I forgot that when programming in Visual Studio (in C) the exe will sometimes display on screen for a second before closing itself. I was giving a lab earlier and told them to use system("PAUSE"). I know it's not ideal. Now it worked on some machines and not on others (would I have to tell them to include stdlib.h?). I'm wondering is there an easy way to rectify this in VS?

    If not would some implementation of getchar() be better?

    Thanks (it's for beginners so I don't want to confuse them too much).


Comments

  • Registered Users Posts: 26,579 ✭✭✭✭Creamy Goodness


    getchar() is better.

    system("pause") will only work in windows.


  • Registered Users Posts: 2,379 ✭✭✭toiletduck


    Thanks but OS dependent stuff is not really much of a concern at the moment (the course is through Visual Studio) and they are absolute beginners.

    Think I've found the answer though. I was showing them that after compiling and building the project to hit F5 (Start Debugging) to execute... Seems Ctrl+F5 (Start without Debugging) does the trick (leaving the output on screen).

    :o

    I can't believe it. D'oh! My first time giving a lab so I'm allowed a get out of jail free card.


  • Registered Users Posts: 40,038 ✭✭✭✭Sparks


    This is why teaching new students with a heavy professional IDE like Visual Studio is a Bad Idea™...


  • Registered Users Posts: 2,379 ✭✭✭toiletduck


    Haha! You're right but it ain't up to me.

    Don't most Irish college's do it that way though?


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Wow, I've just started a thread on that subject. I think its because students like to see results up front.


  • Advertisement
  • Registered Users Posts: 26,579 ✭✭✭✭Creamy Goodness


    toiletduck wrote: »
    Haha! You're right but it ain't up to me.

    Don't most Irish college's do it that way though?
    mine didn't.

    we were 3 years into a 4 year course before we were shown any IDE.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    If you have a solution to your original question can you change the thread to [Solved]? Thanks.


  • Registered Users Posts: 7,265 ✭✭✭RangeR


    toiletduck wrote: »
    I forgot that when programming in Visual Studio

    VS is not a programing language. Have you tried Thread.Sleep(500) or similar?


  • Registered Users Posts: 2,379 ✭✭✭toiletduck


    RangeR wrote: »
    VS is not a programing language.
    toiletduck wrote:
    I forgot that when programming in Visual Studio (in C)

    Evil Phil wrote:
    If you have a solution to your original question can you change the thread to [Solved]? Thanks.

    Done.

    we were 3 years into a 4 year course before we were shown any IDE.

    Well... this is a one year course. Better suited to the other thread methinks.


Advertisement