...
/Redirecting the Standard Input and Output Streams
Redirecting the Standard Input and Output Streams
In this lesson, we will learn how the standard inputs and outputs of programs can be redirected to files or piped to other programs.
All of the programs that we have seen so far have interacted through stdin
and stdout
, the standard input and output streams. Input and output functions like readf
and writeln
operate on these streams by default. While using these streams, we assumed that the standard input comes from the keyboard and that the standard output goes to the screen.
We will start writing programs that deal with files in the next lesson. We will see that, just like the standard input and output streams, files are character streams as well; they are used in almost the same way as stdin
and stdout
. But before seeing how files are accessed from within programs, we will get familiar with how the standard inputs and outputs of programs can be redirected to files or piped to other programs. ...