title: Return variables in real time through programs in c++
body: <p>I have a program written in c++. I'm looking for how I can catch its values in real time with another c++ program. 
  For example I have in the program something like this:</p>
  
  <pre><code>int main()
  {
      int n = 0;
      while (true) {
          cout &lt;&lt; n &lt;&lt; endl;
          n++;
      }
  }
  </code></pre>
  
  <p>That's simple but represents how my real program  works, which gives values to <code>n</code> every few milliseconds.
  Now I want to catch the <code>n</code> values and store them in a new program at the same time it appears in the command windows.</p>