Download

Launching an executable then returning to your game

Hi,

Im trying to launch an executable (.exe) file from somewhere in my computer, letting it run and coming back to my game once that executable has closed (after an indeterminate amount of time). Im using system(FilePath) to run the executable but once I close it it also closes my game (which I’m launching). Im not sure why this is happening or how to fix it. Should I be running the executable in a different way? The game is being made for the HTC Vive if that makes a difference. Any help is appreciated!

Hi !

I think spawn function is better, some useful reading:
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044654269&id=1043284392
http://users.pja.edu.pl/~jms/qnx/help/watcom/clibref/src/spawn.html

I hope this help you ! :slight_smile:

I took a look at both but it doesnt seem to be working. Its worth mentioning that Im actually trying to launch a completely separate game that the user can play for however long he wants, and when they quit they should return back to my game. Here is my current implementation of spawn.

_spawnl(P_WAIT, “C:\Program Files(x86)\Steam\steamapps\common\Surgeon Simulator VR Meet The Medic\Win32\SurgeonVR.exe”, “SurgeonVR.exe”, NULL );

Im not quite sure where I went wrong as Im not familiar with this function. VS 2015 Community Edition recommended that I use _spawnl instead of spawnl but Im not sure why, it would not compile otherwise.