title: How do I pass a ostream and use cout to display on the screen in a function?
body: <p>I want to use istream and ostream as a parameter that my functions take and help me to the work (read file, and display content on the screen).
  I know how to do it with istream:</p>
  
  <pre><code>std::ifstream myfile(...);
  
  void foo(myfile);
  
  void readFoo(std::istream &amp;stream)
  {
    int x, y;
    stream &gt;&gt; x &gt;&gt; y;  //suppose my file contains many rows of 2 numbers.
    //store the x and y to somewhere 
  }
  
  void writeFoo(std::ostream &amp;output)
  {
  ???
  }
  </code></pre>
  
  <p>And what object should I pass to my writeFoo()?</p>
  
  <p>UPDATE:
  Here is the update but I got an error message( cannot convert from ostream to ostream*)</p>
  
  <pre><code>writeFoo(std::cout);
  writeFoo(sd::ostream &amp;out)
  {
    out &lt;&lt; somedata to display to the screen;
  }
  </code></pre>