Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote