redirecting output

I have a spawnl function:

Child = spawnl (P_NOWAIT, “/bin/cp”, “cp”, “-vcLR”, “/source”,
“/destination”, NULL);
this works, it spawns a process to copy from /source to /destination

but I want to re-direct the output to a file called log.txt in my / diretory
so i added >>/log.txt :
Child = spawnl (P_NOWAIT, “/bin/cp”, “cp”, “-vcLR”, “/source”,
“/destination”, “>>/log.txt”, NULL);

now copy commands thinks >>/log.txt is the copy command’s destination.
any suggestion???

this commands works fine in a shell:
cp -vcLR /source /destination >>/log.txt

Hello Ran

This is why I said to use PtSpawn. With PtSpawn you can redirect the output using the
PtSpawnOpts value that t you pass in to the PtSpawm call. This would allow you to
output to a file.

Thanks
Rodney

ran zhang <rzhang@vamcointernational.com> wrote:

I have a spawnl function:

Child = spawnl (P_NOWAIT, “/bin/cp”, “cp”, “-vcLR”, “/source”,
“/destination”, NULL);
this works, it spawns a process to copy from /source to /destination

but I want to re-direct the output to a file called log.txt in my / diretory
so i added >>/log.txt :
Child = spawnl (P_NOWAIT, “/bin/cp”, “cp”, “-vcLR”, “/source”,
“/destination”, “>>/log.txt”, NULL);

now copy commands thinks >>/log.txt is the copy command’s destination.
any suggestion???

this commands works fine in a shell:
cp -vcLR /source /destination >>/log.txt