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.
gilbert_changAsked:
Who is Participating?
 
ZoppoConnect With a Mentor Commented:
At the end of your programm use something like

_spawnl( _P_NOWAIT, lpszAppFullPath, lpszAppFullPath, NULL );

hope that helps,

ZOPPO
0
 
TricksterCommented:
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
0
 
gilbert_changAuthor Commented:
Trickster - what about threads and other memory structures I created in the program.
Trying to start them over might cuase explosions...right?
Thanks.
0
 
gilbert_changAuthor Commented:
Thanks Zoppo!
This works.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.