[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Redirecting stdio using Fforce/Fdup



Jo Even Skarstein wrote:
Hi!

I'm working on a small application that needs to run a .ttp as a child and do some screen scraping on it. Basically I'm building a GEM frontend to an old .TOS-program with a character based UI.

As I need to run this program under both MiNT and MagiC I can't use pty's, so I assume I must use Fforce/Fdup. The problem is that I don't understand how these calls work, and I'm having trouble finding good documentation and programming examples. Can anyone suggest some readable sources that use these calls, or perhaps explain to me how to use them? It would be extremely helpful :-)

Jo Even

Those functions are pretty much the same as Unix dup/dup2 system calls. You first create a pipe, then Fforce the child's stdout/stderr to write to the pipe. Your parent process then reads the pipe to get all of the child's output. If you also need to feed input to the child, then you'll also need a separate pipe for that, and Fforce it to the child's stdin.
--
  -- Howard Chu
  Chief Architect, Symas Corp.  http://www.symas.com
  Director, Highland Sun        http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP     http://www.openldap.org/project/