Running external programs

This is a discussion on Running external programs within the C++ Programming forums, part of the General Programming Boards category; IS there anyway to write a program that can run other programs? (like if I wanted to make a menu ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    6

    Question Running external programs

    IS there anyway to write a program that can run other programs? (like if I wanted to make a menu program, that would run another program depending on which selection they make)

    thnxs

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    FAQ time

  3. #3
    Casual Visitor
    Join Date
    Oct 2001
    Posts
    350
    Be careful.... this is the most basic of methods and can... probably will lead to unpredictable things.

    #include <iostream.h>
    #include <stdlib.h>
    #include <conio.h>

    int main()
    {
    int killapp = -1;
    int choice;

    do
    {
    cout << "1) Notepad\n";
    cout << "2) Wordpad\n";
    cout << "3) Paint\n";
    cout << "4) Quit\n\n";

    cin >> choice;

    switch(choice)
    {
    case 1: system("notepad.exe");
    break;
    case 2: system("Write.EXE");
    break;
    case 3: system("Pbrush.exe");
    break;
    case 4: killapp = 0;
    break;
    default: cout << "Invalid option.";
    break;
    };

    }while(killapp == -1);


    cout << "\nReturned without crashing windows.";

    return 0;

    }
    I haven't used a compiler in ages, so please be gentle as I try to reacclimate myself. :P

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    6

    thanxs

    Thanks! I was lookin at the FAQ, and it mentioned a CreateProcess() command. I looked into it, and it looks like thats what I want, but I can't seem to make it work :-( any help would be appreciated

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  2. running an external exe file
    By cloudy in forum C++ Programming
    Replies: 4
    Last Post: 06-06-2005, 12:55 AM
  3. multithreading question
    By ichijoji in forum C++ Programming
    Replies: 7
    Last Post: 04-12-2005, 10:59 PM
  4. how do i run external programs from source?
    By tameritoke in forum C++ Programming
    Replies: 1
    Last Post: 05-23-2003, 02:44 PM
  5. Running programs as Services
    By Unregistered in forum Windows Programming
    Replies: 2
    Last Post: 10-20-2001, 04:17 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21