Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to restart a program from inside a program?

I am developing a C++ program and it would be useful to use some function, script or something that makes the program restart. It's a big program so restarting all the variables manually will take me long time...

I do not know if there is any way to achieve this or if it is possible.

like image 270
Julen Uranga Avatar asked Oct 13 '16 13:10

Julen Uranga


People also ask

Is there a function to restart the program in Python?

Restart the Program Script in Python Using the os. execv() Function.

How do you auto restart a program in Python?

Now, in a Python Shell, you would have to press either the Run button and then 'Run Module (F5)' or just the F5 key on your keyboard. That is the first time you run it. When the program ended, you would go back to your Cheese.py file and then press F5 to run the program again.

How do you restart a Javascript program?

restart() | ProcessingJS. Calling Program. restart() will restart the program() in the same way as when the user clicks the restart" button.


1 Answers

If you really need to restart the whole program (i.e. to "close" and "open" again), the "proper" way would be to have a separate program with the sole purpose of restarting your main one. AFAIK a lot of applications with auto-update feature work this way. So when you need to restart your main program, you simply call the "restarter" one, and exit.

like image 108
SingerOfTheFall Avatar answered Oct 01 '22 08:10

SingerOfTheFall