0

With the help of the function int system (const char* command); I can execute an application from another application. The stdlib.h contains the function system. For example:

click button1 in application1 -> open application2.

The Button1 clicked event executes the function

system(application2.app);

But when application2 is executed application1 freezes until application2 will be closed. Is it possible to execute application2 without blocking application1?

alk
  • 69,737
  • 10
  • 105
  • 255
3ef9g
  • 781
  • 2
  • 9
  • 19

1 Answers1

2

Use fork

pid_t pid;

pid = fork();
if (pid == 0)
{
    /* this is the new process, execute the other application here */
    system("your application file path");
    _exit(0);
 }
 /* Here you continue in application1

And I would recomment to take a look at the execve and family functions, instead of system.

Iharob Al Asimi
  • 52,653
  • 6
  • 59
  • 97