system("PAUSE") - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

system("PAUSE")

how does 'system("PAUSE")' actually *work*? like how should i go about making my own ones with custom messages?

Comments

  • stoberstober Posts: 9,765Member ✭✭✭
    : how does 'system("PAUSE")' actually *work*? like how should i go about making my own ones with custom messages?
    :
    :

    the system() function just simply executes other programs. In you example it runs the MS-DOS command.com (or cmd.exe) internal function named "pause". You can test this out yourself by typing "pause" in a command prompt.
  • ZruluZrulu Posts: 1Member
    So is this you make a program that runs multiple programs within it? If I wanted to make a program that sequentially ran three different .exe's inside it, would the code look somewhat like this?

    int main()
    {
    system("program1.exe");
    system("program2.exe");
    system("program3.exe");
    }


  • Griz803Griz803 Posts: 100Member
    : So is this you make a program that runs multiple programs within it? If I wanted to make a program that sequentially ran three different .exe's inside it, would the code look somewhat like this?
    :
    : int main()
    : {
    : system("program1.exe");
    : system("program2.exe");
    : system("program3.exe");
    : }

    Well, you could, but you risk problems with certain procedures the programs may run internally. It might crash. Here is some code that compiles under Borland C/C++ 4.52 for DOS that puts a pause message on screen. And you can control the message.
    [code]
    #include //Includes necessary header files, old style
    #include


    int main(void) //The venerable main function
    {
    clrscr(); //Clears the screen
    gotoxy(5,22); // Places the cursor back at the bottom and left
    cout << "Hit <Enter> to continue..."; // Displays message
    cin.get(); // Waits for enter key
    return(0); // Returns 0 so DOS doesn't flip out
    }
    [/code]
  • stoberstober Posts: 9,765Member ✭✭✭
    : So is this you make a program that runs multiple programs within it? If I wanted to make a program that sequentially ran three different .exe's inside it, would the code look somewhat like this?
    :
    : int main()
    : {
    : system("program1.exe");
    : system("program2.exe");
    : system("program3.exe");
    : }
    :
    :
    :

    yes, that's one of several ways to do it.
Sign In or Register to comment.