I would like to fill my vector<float> from command line:
more my.txt | myexe.x > result.txt
What is the best way to open the pipe in C++?
Thanks
Arman.
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.
Your shell will connect the standard output of
moreto the standard input ofmyexe.x. So you can just read fromstd::cin, and need not worry whether the input comes from the keyboard or from some other program.For example: