Re: XForms: Can't get pipes to work right. Solved echo half, not the other

T.C. Zhao (tc_zhao@yahoo.com)
Sat, 21 Aug 1999 13:30:12 -0700 (PDT)

# To subscribers of the xforms list from "T.C. Zhao" <tc_zhao@yahoo.com> :

It probably has something to do with buffering.

--- Jeff PIerce <piercej@preferred.com> wrote:
> # To subscribers of the xforms list from Jeff PIerce
> <piercej@preferred.com> :
>
> While doing 80 mph down the road on my motorcycle it suddenly dawned
> on
> me why the pipe was echoing.... I think of the damnest things at the
> damnest times :-).....
>
> On the same pipe set 0 is hooked to 1, Duh..... Another head up butt.
> You have to create TWO pipes, one for output and one for input.
> closing
> the ones not needed.
> That fixed the echo problem... But, not the child's printf()/puts()
> not
> making it through the pipe... The parents either for that matter.....
> You stiil have to use read()/write() calls. Is not a printf("%s",
> line)
> or puts(line) use the same file as write(STDOUT_FILENO, line,
> strlen(line)??? The child's STDIN_FILENO and STDOUT_FILENO have been
> closed/dup'ed with the in/out pipes.
>
> Jeff PIerce wrote:
> >
> > # To subscribers of the xforms list from Jeff PIerce
> <piercej@preferred.com> :
> >
> > This isn't really a xforms questions,but it occured during xforms
> app
> > development...
> >
> > I am working on a xforms mp3 player... I am using mpg123 as the
> actual
> > player, forking it from the app. No problem....
> >
> > There is a version of mpg123 for interactive use called mpg123m. It
> is
> > included with the tk3play app. mpg123m not only accepts futher
> commands
> > while it is playing, it also gives progress, play time, blocks
> played,
> > etc, will it is running.
> >
> > tk3play uses it's pipes to send and get data. No problem I thought.
> Just
> > use pipes in C.
> >
> > Big problems, at least to me....
> >
> > Pipes don't work like I thought.....
> >
> > I set up a command line test app to spawn mpg123 and take further
> > commands from inut lines and send it to the mpg123m child . No
> problem.
> > I start my app which spawns mpg123m. I then enter 2 0mp3/cobramp3 (
> the
> > command mpg123 expects to begin playing a file) which is read by my
> app
> > and sent through outPipe[1] to mpg123m. It starts playing and it's
> > progress output comes to the screen.
> >
> > I then add the pipe for the output of the child (mpg123m) to come
> back
> > to the parent...NO GO......
> >
> > I try a test app and child to get better aquainted with pipes...
> >
> > I find that if the child wants to send back it HAS to use a write()
> and
> > not puts() or printf().
> >
> > I find that if the parent writes out pipe[0], it is echoed back to
> > pipe[1].
> >
> > How do you overcome these problems.
> >
> > How do you turn off the echo between pipes[0] and pipes[1] at the
> > parent????
> >
> > Why is the child not piping back to the parent when it uses puts()
> or
> > printf()??? This means that you cannot get the output of an app
> piped
> > back unless that app dows not use puts()'s and printf()'s.... How
> can
> > tht be quarantied????
> >
> > I understand that printf() uses streams (FILE *) while write() uses
> file
> > descriptors(integers). But, I thought that printfputs mapped to
> > STDOUT_FILENO....
> >
> > --
> > Jeff Pierce
> > piercej@preferred.com
> > _________________________________________________
> > To unsubscribe, send the message "unsubscribe" to
> > xforms-request@bob.usuhs.mil or see
> > http://bob.usuhs.mil/mailserv/xforms.html
> > XForms Home Page: http://bragg.phys.uwm.edu/xforms
> > List Archive: http://bob.usuhs.mil/mailserv/list-archives/
>
> --
> Jeff Pierce
> piercej@preferred.com
> _________________________________________________
> To unsubscribe, send the message "unsubscribe" to
> xforms-request@bob.usuhs.mil or see
> http://bob.usuhs.mil/mailserv/xforms.html
> XForms Home Page: http://bragg.phys.uwm.edu/xforms
> List Archive: http://bob.usuhs.mil/mailserv/list-archives/
>
>

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuhs.mil or see
http://bob.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/