I know how to program Console application with parameters, example : myProgram.exe param1 param2.
My question is, how can I make my program works with |, example : echo ‘word’ | myProgram.exe?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to use
Console.Read()andConsole.ReadLine()as if you were reading user input. Pipes replace user input transparently. You can’t use both easily (although I’m sure it’s quite possible…).Edit:
A simple
catstyle program:And when run, as expected, the output: