spawn() syntax


I’m currently working on an Autonomous Sailing Vessel project at the University of Adelaide. For the high level control tasks we are planning to implement a QNX Neutrino system.

My query today is the syntax required to get spawn(), and by extension it’s variations, to work?

I’ve tried a few things all to no avail.

todays attempt was:
char *args[] = { “sample”, NULL };
pid_t pid;
struct inheritance inherit;

inherit.flags = 0;

if ((pid = spawn("./././sample/x86/o/sample", 0, NULL, &inherit, args, environ)) == -1)
	perror("spawn() failed");
	printf("spawned child, pid = %d\n", pid);

Although I have previously tried spawnvp() command on a different machine, resulting in the same “spawn() failed: No such file or directory”.

I had thought that it might be project references that were the issue however todays attempt proved this guess to be wrong.

Any assistance would be greatly appreciated,

Here’s a snippet from a working program:


struct inheritance inherit;
char *args[3];
pid_t pid;

inherit.flags = 0;
inherit.pgroup = 0;
inherit.runmask = 0xffffffff;

args[0] = “-x0”;
args[1] = “-y0”
args[2] = NULL;

pid = spawn(“program_name”, 0, NULL, &inherit, args, NULL);

note that ./././sample/x86/o/sample is the same as sample/x86/o/sample

Did you mean …/…/…/sample/…