TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: LEON VARGHESE
from: CAMERON CLARK
date: 1997-09-06 18:29:00
subject: Re: UNIX`s fork

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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.