In C and C++ programs, the standard streams read from the keyboard and write to the screen. Many utilities included in IBM C and C++ Compilers and command line programs use the standard streams. When you launch a program from the operating system GUI, or want input and output operations on these streams to read from and write to files, you can redirect the standard streams.
The Presentation Manager (PM) interface uses the
stdout and stderr streams somewhat differently than
non-Presentation Manager programs. Strings written to stdout or
stderr do not show up on the screen unless redirected.
There are two ways you can redirect the standard streams:
freopen("pia.out", "w", stdout);
bill XYZ 123 > bill.out
You can also use the file handles to redirect one standard stream to another. For example, to redirect stderr to stdout, you use the command:
2> &1
You cannot use redirection from the command line for
memory files.
![]()
Stream
Processing
Standard
Streams
![]()
Run Your Application
View Output to
Standard Streams from PM Programs