title: How to call Linux command from C++ program?
body: <p>I have written the following simple C++ program in order to learn how to call Linux command(s) from C++ program (by using the system command)</p>
  <p>Please advise why I have the errors from the C++ compiler? What is wrong with my program?</p>
  <h2>more exm2.cc</h2>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  int main()
  {
    system(&quot;echo -n '1. Current Directory is '; pwd&quot;);
    system(&quot;mkdir temp&quot;);
    system();
    system();
    system(&quot;echo -n '3. Current Directory is '; pwd&quot;);
    return 0;
  }
  
  
    [root@linux /tmp]# g++ -Wall  exm2.cc  -o exm2.end
  
    /usr/include/stdlib.h: In function גint main()ג:
    /usr/include/stdlib.h:738: error: too few arguments to function גint system(conג
    exm2.cc:7: error: at this point in file
    /usr/include/stdlib.h:738: error: too few arguments to function גint system(conג
    exm2.cc:8: error: at this point in file
  </code></pre>