Reputation: 33
I have written a c++ command line program that successfully reads certain lines from a file, and then does something with the this data.
But, I want to use pipes in unix and windows to accomplish the same task. In order words:
cat file | ./myProgram
I have tried to google this, but I didn't find anything useful. Thanks in advance!
Upvotes: 0
Views: 377
Reputation: 57749
The operating system handles pipes. In the example you posted, the contents of file
are sent to the standard input (cin
) of myProgram
.
So to be "pipe compatible" your program will need to read from cin
to get its input.
Upvotes: 2