Results 1 to 9 of 9
Hi,
How exactly can I make the output of one program, the input of another program?
Thanks!...
- 04-03-2004 #1Just Joined!
- Join Date
- Apr 2004
- Posts
- 4
Pipes question
Hi,
How exactly can I make the output of one program, the input of another program?
Thanks!
- 04-03-2004 #2Just Joined!
- Join Date
- Sep 2003
- Posts
- 83
Hi REL,
You can do this by using the pipe operator "|" (the vertical bar key on your keyboard). The general syntax is:
What happens is the standard output for command1 is piped to as the input for command2. For example, if you want to display a text file page by page on your terminal screen, you can do the following command:Code:$ command1 | command2
Code:$ cat {filename} | more
- 04-03-2004 #3Just Joined!
- Join Date
- Apr 2004
- Posts
- 4
Thanks, but this outputs the text the the second program only when the first program is terminated...
I want the two programs run at the same time... and every character that the first program outputs immedietlly "becomes" the input of the second program, while the first program is still running.
- 04-03-2004 #4Just Joined!
- Join Date
- Sep 2003
- Posts
- 83
Hi,
Can you post what program you need to run and what output you are expecting?
- 04-03-2004 #5Just Joined!
- Join Date
- Apr 2004
- Posts
- 4
The two programs are not important... they are programs wich i wrote for my own needs in C...
One is a console program (the "engine") and one is a GUI of that console program...
I want them to communicate with each other so I thought this would be a good way... maybe im wrong.. :\
Anyway, is what I asked for possible?
- 04-03-2004 #6Just Joined!
- Join Date
- Sep 2003
- Posts
- 83
In your case, an example of what you can do is, run the "engine" program from your GUI. Save the output of the "engine" program and let your GUI program read and display the output.
- 04-03-2004 #7Just Joined!
- Join Date
- Sep 2003
- Posts
- 83
If the "engine" program is a daemon which can communicate via sockets or IPC then you can use these methods to "talk" to the "engine"
- 04-04-2004 #8Just Joined!
- Join Date
- Apr 2004
- Posts
- 4
Thats what I want to do.
Originally Posted by kihbord
But how exactly do I do that? :\
- 04-05-2004 #9Just Joined!
- Join Date
- Sep 2003
- Posts
- 83
One suggestion would be to use the exec() function in C to run the external program.


Reply With Quote
