Printing to the STDOUT vs writing to an output file directly
1
vote
2
answers
2945
views
Is there any rule of thumb when the result of the program should be printed to the stdout by default, and when the more appropriate approach is to accept output file as one of the arguments and write to it? One can always redirect the stdout to a file.
I know that there are different programs, and for example it does not make sense to print to the stdout if the result is multiple files, not a single one. It also does not make sense to accept output file as an argument if the output of the program has temporary nature.
However, what about programs producing output that ultimately should be placed in a single file? Such programs can be further divided into programs accepting input from the stdin and the ones taking input from arguments.
Asked by Al Bundy
(201 rep)
Apr 12, 2021, 06:53 AM
Last activity: Apr 12, 2021, 01:08 PM
Last activity: Apr 12, 2021, 01:08 PM