Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > teeing parent+childs output

Reply
Thread Tools

teeing parent+childs output

 
 
-H
Guest
Posts: n/a
 
      08-18-2003
Hi,

I have a "parent" C program that forks off a "child" C program.
Both the parent and the child print information to both stdout and
stderr.

I would like to redirect the parent and childs output to both stdout
and an output logfile (in effect, a "tee" like behavior).

I've tried several things with pipes and freopens, but I always seem
to get data out of synch.

Any help on this would be greatly appreciated!
Please cc replies to .
Thanks in advance.

- H
 
Reply With Quote
 
 
 
 
Derk Gwen
Guest
Posts: n/a
 
      08-19-2003
(-H) wrote:
# Hi,
#
# I have a "parent" C program that forks off a "child" C program.
# Both the parent and the child print information to both stdout and
# stderr.
#
# I would like to redirect the parent and childs output to both stdout
# and an output logfile (in effect, a "tee" like behavior).
#
# I've tried several things with pipes and freopens, but I always seem
# to get data out of synch.

Each process has its own buffers. To force output to a device, you need to use
fflush or turn off bufferring with setvbuf. This can slow the program down.

--
Derk Gwen http://derkgwen.250free.com/html/index.html
I have no idea what you just said.
I get that alot.
 
Reply With Quote
 
 
 
 
Bryan Donlan
Guest
Posts: n/a
 
      08-19-2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

- -H wrote:

> Hi,
>
> I have a "parent" C program that forks off a "child" C program.
> Both the parent and the child print information to both stdout and
> stderr.


forking isn't in the ISO C specification. Try comp.unix.programmer.
- --
Freenet distribution not available
You're not an alcoholic unless you go to the meetings.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/QYiFx533NjVSos4RAm4EAJ42knygi5fzBMic+nW1KSbZm973CQ CdER2+
lEG1ZU/uEMh0YUx36U/KL54=
=+hIu
-----END PGP SIGNATURE-----
 
Reply With Quote
 
Jack Klein
Guest
Posts: n/a
 
      08-19-2003
On Tue, 19 Aug 2003 00:06:12 -0000, Derk Gwen <>
wrote in comp.lang.c:

> (-H) wrote:
> # Hi,
> #
> # I have a "parent" C program that forks off a "child" C program.
> # Both the parent and the child print information to both stdout and
> # stderr.
> #
> # I would like to redirect the parent and childs output to both stdout
> # and an output logfile (in effect, a "tee" like behavior).
> #
> # I've tried several things with pipes and freopens, but I always seem
> # to get data out of synch.
>
> Each process has its own buffers. To force output to a device, you need to use
> fflush or turn off bufferring with setvbuf. This can slow the program down.


Can you cite the section in either the C or C++ standard that defines
what each process has? If not, don't post this drivel here.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Interactive programs & Teeing conrado.blasco@gmail.com Perl Misc 3 11-28-2006 12:52 AM
Sony Precision Cinema Progressive Output vs Component 480p Output Otto Pylot DVD Video 1 04-18-2004 09:49 PM
Is Fuji S3000 3.2m/pixel output, or 6 m/pixel interpolated output? Peter H Digital Photography 43 12-04-2003 02:35 PM
Output / Debug window output bug? John Bentley ASP .Net 0 09-10-2003 07:38 AM
teeing parent+childs output -H C++ 3 08-19-2003 05:24 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57