Thread: loading in other programs

  1. #1
    Frustrated Programmer :( phantom's Avatar
    Join Date
    Sep 2001
    Posts
    163

    Question loading in other programs

    Couple of questions -
    How do I get other programs to be loaded in from a C++ program?

    A) How do I shut down the program running at the moment and then run another .exe program?

    B) How do I get a video to run for a cut scene?

    C) How can I display an opening image while the program starts?
    My site to register for all my other websites!
    'Clifton Bazaar'

  2. #2
    Registered User Sekti's Avatar
    Join Date
    Feb 2002
    Posts
    163
    You can call a function in a program by useing the system fucntion:
    Code:
    #include <stdlib.h>
    #include <iostream.h>
    
    int main()
    {
    cout<<Loading notepad...."<<endl;
    system("notpad.exe");
    return 0;
    }
    +++
    ++
    + Sekti
    ++
    +++

  3. #3
    Registered User xlnk's Avatar
    Join Date
    Mar 2002
    Posts
    186
    the best things in life are simple.

  4. #4
    Frustrated Programmer :( phantom's Avatar
    Join Date
    Sep 2001
    Posts
    163
    thanks sekti.

    To Xink and others that noticed my question was in the F.A.Q -> my apologies, I have read the F.A.Q before but it was so long ago that I didn't remember it was there. What I normally do is do a search through the existing posts to see if my question has already been asked.
    My site to register for all my other websites!
    'Clifton Bazaar'

  5. #5
    Frustrated Programmer :( phantom's Avatar
    Join Date
    Sep 2001
    Posts
    163

    further questions

    After doing the 'system' method I realised that the old program doesn't shut down, any way to do that?
    Is there a special way to keep one or two variables when starting a new program?
    My site to register for all my other websites!
    'Clifton Bazaar'

  6. #6
    Seņor Member
    Join Date
    Jan 2002
    Posts
    560
    You could use exit(); (I'm not sure what header that's in) or you could use a goto and go to the hend of a program, but both of those are considered bad coding. To keep the variables you can save them to a text file.

    edit: If you are in main, you can put a return statement in to end the program.

  7. #7
    Registered User Liam Battle's Avatar
    Join Date
    Jan 2002
    Posts
    114
    exit() is in the stdlib.h
    and or
    process.h

    either one is acceptable... you can use that to terminate the program premature, or you can return something to the system.
    anyhow i dont suggest using goto's , just use exit() function, its better coding than a goto...
    LB0: * Life once school is done
    LB1: N <- WakeUp;
    LB2: N <- C++_Code;
    LB3: N >= Tired : N <- Sleep;
    LB4: JMP*-3;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Cargo loading system
    By kyle rull in forum C Programming
    Replies: 1
    Last Post: 04-20-2009, 12:16 PM
  2. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  3. Loading icons from other programs
    By Magos in forum Windows Programming
    Replies: 11
    Last Post: 03-01-2006, 01:48 PM
  4. POSIX/DOS programs?
    By nickname_changed in forum C++ Programming
    Replies: 1
    Last Post: 02-28-2003, 05:42 AM
  5. Loading Screen
    By pinkcheese in forum Windows Programming
    Replies: 2
    Last Post: 04-06-2002, 11:48 PM