I would like to fork() in a C++ program I'm writing and then alter an error
string in the parent from the child. How do I need to declare this string
to
be able to access/change it from both the child and the parent.
TIA,
Brad
TIA,
Brad
You could try to place the string in a shared memory segment (IQuote:> I would like to fork() in a C++ program I'm writing and then alter an error
> string in the parent from the child. How do I need to declare this string
> to
> be able to access/change it from both the child and the parent.
> TIA,
> Brad
You could have a set of pipes for passing status codes (i.e.
messages) between child and parent.
If you would consider using POSIX Threads, this kind of thing
gets easier.
--
Andreas K?h?ri
--------------------------------------------------------------
Stable, secure, clean, free: www.netbsd.org
Sure, shared memory is a pretty straightforward way to do this.Quote:> Submitted by "Brad Hubbard" to comp.unix.programmer:
>> I would like to fork() in a C++ program I'm writing and then alter an
>> error string in the parent from the child. How do I need to declare
>> this string to
>> be able to access/change it from both the child and the parent.
>> TIA,
>> Brad
> You could try to place the string in a shared memory segment (I
> don't know how to), but a more resonable way would be to let the
> parent change its own string depending on some message sent from
> the child.
> You could have a set of pipes for passing status codes (i.e.
> messages) between child and parent.
> If you would consider using POSIX Threads, this kind of thing
> gets easier.
Here's a link to a site that might be helpful to you:
http://www.piratehaven.org/~beej/guide/ipc/
This guy is pretty good. I've found an error or two, which he accepted
without getting defensive.
I'd recommend starting with his page.
> Here's a link to a site that might be helpful to you:
> http://www.piratehaven.org/~beej/guide/ipc/
> This guy is pretty good. I've found an error or two, which he accepted
> without getting defensive.
> I'd recommend starting with his page.
Brad
1. How to export variables from Child to parent
Hi,
I am writing a small shall script. I want to invoke a child process by
program &
and the program changes some of the variables.
How can I check the changes variable. I can used exit # and check the # .
If there is any other way to check the variables, please send me a note ...
Any help is greatly appreciated ......
Thanks ,
--
Shashi Peter Mara..... _|~-. | Austin, TX 78750
Working at, not speaking for, IBM \) |
2. Printer
3. Parent and Child process accessing global variable?
4. 2.5.56 kernel floppy driver bug
5. fork, parent, child and global variables
6. Looking for XFree86-4.0.x rpms for Redhat 6.x?
7. passing a child variable back to parent
9. Environment Variable -- Child to parent
10. Parent / Child - parent exit problem
11. signals: stop child, parent told child died !
12. Can ksh script alter the environment of parent bash?
13. Parent wait for child to finish or kill it after 1 minute