title: ftruncate on linux gives invalid arguments error
body: <p>I have looked at <code>ftruncate</code> documentation from <a href="http://linux.die.net/man/2/ftruncate" rel="nofollow">here</a>, as well as well from <a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/apis/ftruncat.htm" rel="nofollow">here</a>. In the case of IBM link, I implemented my <code>ftruncate</code> accordingly but it gives me <code>Invalid Arguments</code> error. Here is the code:</p>
  
  <pre><code>char const *path = "mozunit.txt";
  int file_ = open(path, O_RDONLY, 0600);
  int ftrunc_ = ftruncate(file_, 1);
  cout&lt;&lt;strerror(errno)&lt;&lt;endl;
  </code></pre>
  
  <p>Why is it? I tried changing the second parameter in <code>ftruncate</code> but to no avail.</p>