is there anyway in C that i can stop command window from closing immediately

Respondida is there anyway in C that i can stop command window from closing immediately

  • Thursday, September 20, 2012 11:33 PM
     
     

    I have tried ctrl+f5 and debug/release. 

    that doesnt work

    also i tried console read(); idk if that needs some header file input. Anyone?

All Replies

  • Friday, September 21, 2012 12:18 AM
     
     Answered
    I have tried ctrl+f5 and debug/release.
     
    that doesnt work
     
    also i tried console read(); idk if that needs some header file input. Anyone?
    Many many ways.
     
    Start without debugging (Ctrl+F5) should work.
     
    What I usually do is place a breakpoint on the final (return 0;) statement.
     

    David Wilkinson | Visual C++ MVP
  • Saturday, September 22, 2012 4:28 PM
     
     Answered Has Code

    use following methods

    //method1
    getch();
    //method2
    system("pause");
    //method3
    while(!_kbhit());
    


    Thanks, Renjith V R