Email address obfuscation in effect -- please
click here to turn it off.
[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Mike Miller wrote:
>
> On Wed, 3 Jul 2002, Paul Saab wrote:
>
> > man popen
>
> Thanks, Paul! That really looks like the one I want.
>
> And thanks also to the other people who made suggestions.
>
If you want to start a program and either write to stdin or read to
stdout of that program from your C program, popen really is the way to
go.
If you want to start a program and do both - that is write to stdin and
read stdout at the same time (so for example to use egrep as some kind
of filter with your data) the problem really is quite a bit more
complicated. You have to use dup or dup2 and exec just as someone else
suggested, but there are other issues because it is quite easy to get
your program to lock up (mostly due to buffered io with the program you
are wanting to access). I spent a great deal of time working on this
problem, and a solution is part of a program I wrote:
http://www.math.missouri.edu/~stephen/software/dispense/
If that is your problem (to read and write to a program simultaneously)
send me a private email, and I will to help you.
--
Stephen Montgomery-Smith
EMAIL:PROTECTED
http://www.math.missouri.edu/~stephen
--
To unsubscribe, go to http://mlug.missouri.edu/members/edit.php
Archives are available at http://mlug.missouri.edu/list-archives/