Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6060547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:50:18+00:00 2026-05-23T08:50:18+00:00

From http://www.cplusplus.com/reference/iostream/cout/ : By default, most systems have their standard output set to the

  • 0

From http://www.cplusplus.com/reference/iostream/cout/:

By default, most systems have their standard output set to the console, where text messages are shown, although this can generally be redirected.

I’ve never heard of a system where stdout is anything other than a console window, by default or otherwise. I can see how redirecting it might be beneficial in systems where printing is an expensive operation, but that shouldn’t be an issue in modern computers, right?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:50:19+00:00Added an answer on May 23, 2026 at 8:50 am

    On most systems you can redirect the standard input/output/error to other file descriptors or locations.

    For example (on Unix):

    ./appname > output
    

    Redirects the stdout from appname to a file named output.

    ./appname 2> errors > output
    

    Redirects stdout to a file named output, and all errors from stderr to a file named errors.

    On unix systems you can also have a program open a file descriptor and point it at stdin, such as this:

    echo "input" > input
    cat input | ./appname
    

    This will cause the program to read from the pipe for stdin.


    This is how in unix you can “pipe” various different utilities together to create one larger tool.

    find . -type f | ./appname | grep -iv "search"
    

    This will run the find command, and take its output and pipe it into ./appname, then appname‘s output will be sent to grep‘s input which then searches for the word “search”, displaying just the results that match.

    It allows many small utilities to have a very powerful effect.


    Think of the >, <, and | like plumbing.

    > is like the drain in a sink, it accepts data and stores it where you want to put it. When a shell encounters the > it will open a file.

    > file
    

    When the shell sees the above, it will open the file using a standard system call, and remember that file descriptor. In the above case since there is no input it will create an empty file and allow you to type more commands.

    banner Hello
    

    This command writes Hello in really big letters to the console, and will cause it to scroll (I am using Unix here since it is what I know best). The output is simply written to standard out. Using a “sink” (>) we can control where the output goes, so

    banner Hello > bannerout
    

    will cause all of the data from banner’s standard output to be redirected to the file descriptor the shell has opened and thus be written to a file named bannerout.

    Pipes work similarly to >‘s in that they help control the flow of where the data goes. Pipes however can’t write to files, and can only be used to help the flow of data go from one point to another.

    For example, here is water flowing through several substations and waste cleaning:

    pump --from lake | treatment --cleanse-water | pump | reservoir | pump > glass
    

    The water flows from the lake, through a pipe to the water treatment plant, from the plant back into a pump that moves it to a reservoir, then it is pumped once more into the municipal water pipes and through your sink into your glass.

    Notice that the pipes simply connect all of the outputs together, ultimately it ends up in your glass.

    It is the same way with commands and processing them in a shell on Linux. It also follows a path to get to an end result.

    Now there is one final thing that I hadn’t discussed yet in my previous statements, that is the < input character. What it does is read from a file and output it to stdin on programs.

    cat < bannerout
    

    Will simply print what was stored in bannerout. This can be used if you have a file you want to process, but don’t want to prepend cat <file> because of not wanting to run an extra command in the chain.

    So try this:

    echo "Hello" > bannerinput
    banner < bannerinput
    

    This will first put the string “Hello” in the file bannerinput, and then when your run banner it will read from the file bannerinput.

    I hope this helps you understand how redirection and pipping works on Unix (some if not most will apply to Windows as well).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From http://www.cplusplus.com/reference/stl/bitset/ : Because no such small elemental type exists in most C++ environments,
Here is an example of polymorphism from http://www.cplusplus.com/doc/tutorial/polymorphism.html (edited for readability): // abstract base
I was just reading a little bit on them from http://www.cplusplus.com/doc/tutorial/namespaces/ and it seems
I have learned so much from http://www.summerofnhibernate.com/ nhibernate screen casts that i wonder why
According to http://www.cplusplus.com/reference/clibrary/ctime/time_t/ time_t is the number of seconds since midnight 1/1/1970 UTC. So
Taken from here: http://www.cplusplus.com/doc/tutorial/inheritance/ What is inherited from the base class? In principle, a
I have a silly question. I read this article about std::exception http://www.cplusplus.com/doc/tutorial/exceptions/ On catch
we are using NCover from http://www.ncover.com/ For our application we have 6 different solution
Based on http://www.cplusplus.com/reference/stl/vector/vector/ explicit vector ( const Allocator& = Allocator() ); This vector constructor
I have just installed SSMS tools pack from http://www.ssmstoolspack.com everything seems to work except

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.