Link to home
Start Free TrialLog in
Avatar of gilbert_chang
gilbert_chang

asked on

restarting a program from itself

After the user finishes with the program I write, I want the program to restart automatically (it starts in a 'sleep' mode).
What is the best way to restart the program from it's own end?
Thanks.
Avatar of Trickster
Trickster

Is there any reason why you can't just include the main-code in a while-loop? For example using

int looping = 0;
while (looping == 0)
{
    PROGRAM!
    if (userWantsToQuit)
        looping = 1;
}

I often use a Timer which runs the program when I want the program to restart after a set number of seconds..

Trickster
ASKER CERTIFIED SOLUTION
Avatar of Zoppo
Zoppo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gilbert_chang

ASKER

Trickster - what about threads and other memory structures I created in the program.
Trying to start them over might cuase explosions...right?
Thanks.
Thanks Zoppo!
This works.