home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!agate!linus!linus.mitre.org!elara.mitre.org!bdickens
- From: bdickens@elara.mitre.org (Brian Dickens)
- Subject: UNIX pipes in C
- Message-ID: <1992Dec29.183248.8309@linus.mitre.org>
- Keywords: UNIX, pipes, C
- Sender: news@linus.mitre.org (News Service)
- Nntp-Posting-Host: elara.mitre.org
- Organization: Research Computer Facility, MITRE Corporation, Bedford, MA
- Date: Tue, 29 Dec 1992 18:32:48 GMT
- Lines: 31
-
- I am attempting to write a program that will control another program -- by
- means of pipes. For example, suppose I have one program that does math
- calculations, called calc. A sample interaction with calc might look like this:
-
- % calc
- CALC PROGRAM... Please enter your problem: 3+5
- 8
- CALC PROGRAM... Please enter your problem: 8*8
- 64
- CALC PROGRAM... Please enter your problem: quit
- Thank you for using CALC PROGRAM.
- %
-
- Another program wishes to perform calculations with calc. For example,
- this program could be called frontend. Frontend would look something
- like this:
-
- % frontend
- FRONT END TO THE CALCULATOR... Please enter your expresssion: 2+7
- RESPONSE FROM THE CALCULATOR is 9. Thank you for using frontend!
- %
-
- The program which corresponds to the "calc" program above has already
- been written. I need to know what kind of code I have to write to set up a
- link between my program (analogous to "frontend") and the "calc" program.
- The manpages for fork() and pipe() are very confusing for me, and I don't
- see how to do this.
-
- Any help would be appreciated... Thanks!
- <<<?>>> bdickens@elara.mitre.org <<<!>>>
-
-