title: How do I fix an "ignoring return value" error?
body: <p>I don't know why I get this error with <code>chdir</code>. I tried to use <code>if(chdir(C-&gt;args[1])==1); else</code> but it does not work:</p>
  
  <pre><code>if(C-&gt;arg_count &gt; 1)
  {
      chdir(C-&gt;args[1]);
  }
  else
  {
      chdir(getenv("HOME"));
  }
  </code></pre>
  
  <p>This is the error:</p>
  
  <pre><code>error: ignoring return value of ‘chdir’, declared with attribute warn_unused_result [-Werror=unused-result]
      chdir(C-&gt;args[1]);
      ^~~~~
  </code></pre>