title: Why does Eclipse's C application launch terminal print garbage upon invoking `system("clear")` (defined in stdlib.h)?
body: <p>I am using Eclipse Oxygen.3A for development with C, and the operating system on which I'm running is Fedora 28. The C project that I am attempting to debug contains multiple instances of <code>system("clear");</code>. When I would compile and run the application from Fedora's local terminal, any calls to <code>system()</code> would behave normally. After using Eclipse's debug tools to "step over" the statement and execute it, the launch terminal printed garbage (see screenshot below). The same output is printed every time the program is run. </p>
  
  <p><img src="https://i.stack.imgur.com/H4nKl.png" alt="Eclipse debug console printing garbage after &lt;code&gt;system(&quot;clear&quot;)&lt;/code&gt; is executed"></p>
  
  <p>I created a new project with the same environment variables which isolated that statement, but received the same result (see screenshot below). The only environment variable present in either launch configuration is <code>TERM</code> which is set to <code>xterm-256color</code> (the value printed by Fedora's local terminal when given the input <code>echo $TERM</code>). I couldn't find any results online pertaining to this particular issue, and don't understand how the function is implemented during compilation.</p>
  
  <p><img src="https://i.stack.imgur.com/uznrD.png" alt="Separate &quot;Test&quot; project producing the same result"></p>
  
  <p>Contents of source file in Test project:
      #include </p>
  
  <pre><code>int main(void) {
      system("clear");
      return 0;
  }
  </code></pre>
  
  <p>Generated output:
  <code>'[ESC]' + "[3J" + '[ESC]' + "[H" + '[ESC]' + "2J"</code></p>
  
  <p>Note: Imagine this string concatenated. I couldn't write the output literally because StackOverflow is unable to represent the "escape" character.</p>
  
  <p>My knowledge of Linux, bash and the tools provided by GNU is fairly limited, so let me know if any more information on this case would be helpful along with how to obtain it. Also, any feedback on how I could improve this post is welcome.</p>