title: C: creating named pipe using mknod() not working
body: <p>Language: C
  OS: Ubuntu</p>
  
  <p>I'm simply trying to create a FIFO named pipe using the command:</p>
  
  <pre><code>state = mknod("pipe.txt", S_IFIFO | 0666, 0);
  </code></pre>
  
  <p>the problem is i always get the state's value to be -1 (meaning it has failed) instead of 0.</p>
  
  <p>perror returns 'pipe.txt: File exists'</p>
  
  <p>i have no idea how should i debug such issue or what could be the reason, hope anyone code guide me what's wrong.</p>
  
  <p>(note: the file pipe.txt exist on same path as source file.)</p>