I want to read data from GtkListStore and build an excel by phpExcel. First, I build a php file according to the GtkListStore, then I use php and phpexcel lib to compile and build execl file.
In my gtk code (compile in MinGW environment), I use execvp(cmd[0], (const char **)cmd); to call the external command — php. In fact, cmd[0] is php.exe and cmd[1], cmd[2] … are the parameters for php. After calling the php command, my gtk main window is closed and it quits my gtk program.
How can I prevent the php command from quitting main program? Should I use something else instead of execvp? Thank you.
execvp()and friends replace the current process with another process, so it’s no surprise that your program quits. Useg_spawn_sync()or a related function – that will run your php program, then return control to your original program.