LV> Does anyone know how to pass variables from a parent process
LV> to a child process?
The child is just a copy of the parent; however, in the child
process, the fork routine returns zero.
if (fork()) {
"I'm the child part of the if";
} else {
"I'm the parent part of the if";
}
The child gets a copy of all variables at the point of the fork() -
if you want the parent and the child to have the same variables and
not just a copy at the point of the fork, you will have to allocate
and typecast a block of smem (shared memory).
--- GEcho 1.00
---------------
* Origin: Digital OnLine Magazine! - (409)838-8237 (1:3811/350)
|