Eli5 what a STDOUT is in computing and what’s an example of it?

596 views

It’s so hard to understand what it is with definitions from Wikipedia and other random websites that come up when I Google it

In: Technology

4 Answers

Anonymous 0 Comments

Standard out. Whatever you have defined as a standard output. When you run a command that goes to STDOUT it’ll go there. Display, printer, disk…. define your STDOUT and stuff will go there

Anonymous 0 Comments

It’s just the typical program output stream. Standard Output.

For example, if you do cout or a print statement it goes to stdout. stdout is typically piped to the screen, but can be piped to a file or another executable.

Related, Standard input is for inputs and standard error is the stream for error messages.

Anonymous 0 Comments

People who want to interact with a computer at a low level efficiently (embedded engineers, sysadmins, networking professionals) use the command line. The command line is a magical place where you don’t have to touch a stupid mouse and most of what you are doing can be guessed after a few characters. When those people talk to a program they can use “stdin” which is the “standard input”, when the program wants to talk to them it can use “stdout” or “stderr” the former for normal output, the latter for errors. People usually use stdout as the command line they are using, but it can be redirected to the input to another program for processing.

Anonymous 0 Comments

Software programmer here, others have given you the simple answer but I’ll give you the in-depth one:

The most basic data structure is an array. An array is a fixed length chunk of memory that you can store more than one item in.

Arrays have several problems though, in particular that they are fixed length. We can improve an array by changing it into what C++ calls a vector (other languages call it a list or an array list). This data structure wraps the array with some logic. When the array gets full, the logic automatically creates a new larger array and moves everything to it.

We will focus on a specific usage of an array called a queue. A queue has elements created at the end and deleted at the beginning. However, a basic implementation of a vector can’t easily delete elements at the beginning and so instead would waste time and effort. To fix this, we make the vector “circular”. This changes the “beginning” from a fixed position at the start to moveable. Think of this like an image of an ouroboros, the snake eating its own tail. Essentially, it allows us to re-use space at the start of the array that was taken up by deleted elements without needing to move existing elements.

The next and final improvement is a bit different. Moving data from one place to another is a very common operation. While this can be done using a circular vector, we really don’t want to be bothered by all of these complex details of how exactly it is done. So we separate the usage of it (interface) from the details of how it works (implementation). We call the resulting data structure for moving data from one place to another a stream. We don’t care how a stream is built under the hood. It might use a circular vector, or it might use something more complicated. What we do care about is a stream’s interface, which has two main pieces of functionality: writing data to the stream from a source, and reading data from the stream to a destination.

To finally answer your question, STDOUT is a special stream called “Standard Out”. What makes it special is three things: it is automatically created when a process is launched, special functions like printf write to it by default, and your screen reads from it by default.