You have written and compiled a program \"myProg\" that normally reads input fro
ID: 3769307 • Letter: Y
Question
You have written and compiled a program "myProg" that normally reads input from the keyboard. You have decided that you would like to run it but to have the input supplied from a file "myFile.txt".
Which of the following would work?
./myProg < myFile.txt
echo myFile.txt | ./myProg
cat myFile.txt > ./myProg
cat myFile.txt | ./myProg
./myProg > myFile.txt
./myProg myFile.txt
./myProg < myFile.txt
echo myFile.txt | ./myProg
cat myFile.txt > ./myProg
cat myFile.txt | ./myProg
./myProg > myFile.txt
./myProg myFile.txt
Explanation / Answer
./myProg < myFile.txt
Since program is already compiled we ./ to run the executable in shell or command line.
< is used to supply input and > is used for output.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.