home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.prolog
- Path: sparky!uunet!munnari.oz.au!hp9000.csc.cuhk.hk!cucs5.cs.cuhk.hk!bmtong
- From: bmtong@cucs11.cs.cuhk.hk (Tong Bo-Ming)
- Subject: Re: Pipes in Quintus
- Message-ID: <1992Aug30.090317.4088@cucs5.cs.cuhk.hk>
- Sender: news@cucs5.cs.cuhk.hk
- Organization: Faculty of Engineering, The Chinese U. of Hong Kong
- References: <17ljnjINNlbo@swan.doc.ic.ac.uk>
- Date: Sun, 30 Aug 1992 09:03:17 GMT
- Lines: 47
-
- jvp@doc.ic.ac.uk (Jeremy Pitt) writes:
-
- >I've got this Quintus prolog program and this C program and, quite
- >unreasonably really, I want them to `talk' to each other.
-
- >However, the Quintus library predicate popen only allows me to get
- >hold of one end of the pipe: I can either read from it or write
- >to it, but not both.
-
- >Does anybody either (a) know of an easy way of doing both or (b) have
- >a library package which exports predicates to do this.
-
- >Oh, and on top of that the C program writes its output to standard
- >error (don't ask). So what I want is to be able to send stuff from
- >my Quintus program through the pipe to the C program, and pick up
- >its output off standard error when its finished munging about with
- >it.
-
- >Don't want much, do I? However, any help with this would be greatly
- >appreciated. Thanks,
-
- >Jeremy
- >--
- >Jeremy Pitt, Department of Computing, Imperial College of Science, Technology
- >& Medicine, Huxley Building, 180, Queen's Gate, London, England, SW7 2BZ.
- >jvp@doc.ic.ac.uk +44 71 589 5111 ext 4983
-
- I think it would be worth trying to create two named pipe files
- (if you're using System V) in the /tmp directory, one for Quintus -> C
- and the other for C -> Quintus. You can redirect stderr and stdin of the
- C program to these pipes. Try using open/3 to open these pipe files in
- Quintus (not quite sure whether this works). If this does not work, try
- redirecting Quintus' input and output streams to these files. (tell/1,
- told/0, etc). If all these fails, write a small C program for opening
- pipe files and link it to Quintus.
-
- Some time ago, I tried these techniques, but now I have already
- forgotten how I let Quintus and C talk to each other exactly. Of course,
- the solution depends on the particular situation. If this is not detailed
- enough, you may send a email to me so that I will try these things out
- myself to give you a more complete answer.
- ________________________________________________________________
- | Was entstanden ist, das muB vergehen ! |
- | Was vergangen, auferstehen ! |
- | Mahler: Symphony No. 2 "resurrection" |
- |________________________________________________________________|
- Tong Bo-Ming email: bmtong@cs.cuhk.hk
-