Redirecting input and output streams
I just started on SPOJ. It tests by redirecting standard input and output to files. Is there a way to do that directly from the terminal instead of modifying the program.
v3ga
Junior Poster in Training
95 posts since Oct 2011
Reputation Points: 14
Solved Threads: 4
If your on linux you can use the '<' operator. As in ./app < fileName it gets the input from the file instead of direct terminal.
firstPerson
Senior Poster
3,923 posts since Dec 2008
Reputation Points: 841
Solved Threads: 608
If your on linux you can use the '<' operator. As in ./app < fileName it gets the input from the file instead of direct terminal.
So after compiling should i use ./a.out < filename ?
What about output?
v3ga
Junior Poster in Training
95 posts since Oct 2011
Reputation Points: 14
Solved Threads: 4
If you want to redirect the output from terminal you use the '>' operator to a file. As in ./app < inputFile > outputFile
firstPerson
Senior Poster
3,923 posts since Dec 2008
Reputation Points: 841
Solved Threads: 608
v3ga
Junior Poster in Training
95 posts since Oct 2011
Reputation Points: 14
Solved Threads: 4