title: spawning a new terminal and writing to its stdout
body: <p>I have an application that uses a gui to do most of its interface with the user. However I would like to have a separate terminal window that I can write to for some error checking, raw values etc.</p>
  
  <p>I know I can spawn a new terminal with the <code>system()</code> command but I have no idea if interaction is possible.</p>
  
  <p>in the best possible scenario I would like to have a function which takes a string(char array I know...), and prints it to the newly spawned console window:</p>
  
  <p>something like:</p>
  
  <pre><code>int func(char *msg) {
      static // initiate some static interface with a newly spawned terminal window.
  
      // check if interface is still valid
  
      // send data to terminal
  
      return 0; //succes
  
  }
  </code></pre>