Re: how to write a utility which can be use in pipe?
Re: how to write a utility which can be use in pipe?
am 11.10.2005 17:53:06 von Jan Schampera
wyhang@gmail.com wrote:
> ls | a
> then a can process every output of 'ls' command and output to terminal.
> if a is programmed by C language, how should I implement it?
STDIN, STDOUT
Regards,
Jan
--
"Be liberal in what you accept, and conservative in what you send."
- J. B. Postel, master of the net.
Re: how to write a utility which can be use in pipe?
am 11.10.2005 18:13:15 von wyhang
thank you Jan, but can you give me a little more detail?
Re: how to write a utility which can be use in pipe?
am 11.10.2005 18:15:15 von wyhang
oh, thank you, I got it, I'll do some test~
Re: how to write a utility which can be use in pipe?
am 11.10.2005 18:18:10 von Jan Schampera
wyhang@gmail.com wrote:
> thank you Jan, but can you give me a little more detail?
Read from the file STDIN, and write to the file STDOUT (macros,
that should be defined by stdlib?).
[f]scanf() will work for the first tries. Or any other I/O
functions for files.
Regards,
Jan
--
"Be liberal in what you accept, and conservative in what you send."
- J. B. Postel, master of the net.
Re: how to write a utility which can be use in pipe?
am 11.10.2005 18:22:15 von wyhang
got it. thank you very much, Jan~
Re: how to write a utility which can be use in pipe?
am 11.10.2005 19:38:48 von darkknight56
In the C programming book by Kehrnigan and Richie (I apologize for any
misspelling) they show an example of a C program that accepts input
from either a file or STDIN and sends output to either a file or STDOUT.