Restart console application command

Apr 2, 2015 at 7:01pm
Hi,

i need a way to restart my console application. I don't think a do-while loop can help me, because the restart should happen in the middle of the code, if a condition isn't achieved after several attempts. Also if the program is restarted, all instances of classes should be removed.

Thanks in advance!
Apr 2, 2015 at 8:05pm
Move the code for the running loop into a separate function from main. When you want to "restart" you return from your running loop and allow main to evaluate the returned value to determine if it should call into that function again or exit. RAII takes care of the rest.
Apr 4, 2015 at 1:40pm
Thank you very much!
Topic archived. No new replies allowed.