Quiting Out Of An App


mac-10

Still Fresh
Joined
Oct 27, 2006
Messages
56
Age
44
Website
Visit site
Hi there

I am in need of a bit of help. I have just started code my first game and run into a problem. I can’t seem to quit out of my app then I include the following lines of code
CODE

chdir("/usr/gp2x");
execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);


I get the following error

QUOTE

'chdir' was not declared in this scope
'execl' was not declared in this scope



have I failed to link something or missing an include some where?

Thanks

Mac :)
 
It's actually bad practise to do that to quit the application. It's better to use a script to wrap around the program that relaunches the menu.

Why?
If you do that code above and the application crashes... it will never run those lines of code. If you just "return 0" instead and use a script to launch the program, relaunch the menu, then if the app crashes, the menu will be relaunched. :)

And in answer to your question I'm unsure which lib you could be forgetting to include/link
 
#include <unistd.h>

but like PokeParadox says it's better to just exit and have a script that restarts the menu. It makes the program more flexible when better menus come along
 
Hi

Thanks your getting back to me.
are there any example out there of a script that will
allow me to lunch the menu?

Thanks again for you help

Mac :)
 
Back
Top