What do the terms stdin, stdout and stderr mean with respect to file I/O in MATLAB as used in the MATLAB documentation?

27 views (last 30 days)
The documentation of the function FOPEN uses the terms stdin, stdout and stderr. What do these terms mean? They are not defined anywhere in the MATLAB documentation.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The terms stdin, stdout and stderr are not MATLAB-specific terms but are general terms used by the computer science community for standard input stream, standard output stream and standard error stream. The following are definitions from Wikipedia (<http://www.wikipedia.org>).
Standard input is data (often text) going into a program. The program requests data transfers by use of the read operation. Not all programs require input. For example, the dir or ls program (which displays file names contained in a directory) performs its operation without any stream data input. Unless redirected, input is expected from the text terminal which started the program.
Standard output is the stream where a program writes its output data. The program requests data transfer with the write operation. Not all programs generate output. For example the file rename command (variously called mv, move, ren) is silent on success. Unless redirected, standard output is the text terminal which initiated the program.
Standard error is another output stream typically used by programs to output error messages or diagnostics. It is a stream independent of standard output and can be redirected separately. The usual destination is the text terminal which started the program to provide the best chance of being seen even if standard output is redirected (so not readily observed). For example, output of a program in a pipeline is redirected to input of the next program, but errors from each program still go directly to the text terminal.
Thus, as far as MATLAB is concerned, stdin refers to input from the command window, stdout refers to output to the command window and stderr also refers to output to the command window.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by