How does one call an external executable from within a Photo

I have created an application that responds message sent from a second
computer. When the app receives the message (an integer of “2” for
example) I would like a 2nd executable to be called, and if the main app
receives a different integer (“3” for example) another external executable
should be called

TIA

BTW I am a programming novice, so please excuse the ignorance of the
question.

Previously, a-cherian@northwestern.edu wrote in qdn.public.qnx4.photon:

I have created an application that responds message sent from a second
computer. When the app receives the message (an integer of “2” for
example) I would like a 2nd executable to be called, and if the main app
receives a different integer (“3” for example) another external executable
should be called

The simplest way would be with the system() subroutine. Here’s a simple
mock up of how you might want to do it.


switch(msg.value)
{
case ‘2’:
system(“executable_2 &”);
break;
case ‘3’:
system(“executable_3 &”);
break;
}

The ‘&’ would cause the executable to excute separately from
the Photon application. Without it, system() would wait for
the executable to finish.

A little more sophisticated way to do this would be with a spawn…()
routine. I’ll let you check the documentation out for more information.

PtSpawn() is also a nice function to use.


Mitchell Schoenbrun <maschoen@pobox.com> wrote:

Previously, > a-cherian@northwestern.edu > wrote in qdn.public.qnx4.photon:

I have created an application that responds message sent from a second
computer. When the app receives the message (an integer of “2” for
example) I would like a 2nd executable to be called, and if the main app
receives a different integer (“3” for example) another external executable
should be called



The simplest way would be with the system() subroutine. Here’s a simple
mock up of how you might want to do it.



switch(msg.value)
{
case ‘2’:
system(“executable_2 &”);
break;
case ‘3’:
system(“executable_3 &”);
break;
}

The ‘&’ would cause the executable to excute separately from
the Photon application. Without it, system() would wait for
the executable to finish.

A little more sophisticated way to do this would be with a spawn…()
routine. I’ll let you check the documentation out for more information.