简体   繁体   中英

For my C assignment, I am don't understand what it means by using redirection to test the program?

I don't understand what my assignment means about redirection. My assignment says:

Use input redirection to test your program. Note that your program reads from the user using scanf and input redirection feeds the file contents to your program. You don't have to use any file operations in your program. Consider the following file a.txt:

 4 10 20 15 5 -1 

Does this mean that I have to make a a.text file? where does the a.txt file with the numbers even come from???

The instructor is telling you to create a text file with a series of numbers in it to feed to your program. Input redirection means using < at the shell when running your program to make it use the given file as stdin.

For example:

./myprogram < a.txt

The file a.txt is treated as the program's stdin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM