title: What is the difference between open and creat system call in c?
body: <p>I tried both creat and open system call. Both working in the same way and I can't predict the difference among them. I read the man page. It shows "Open can open device special files, but creat  cannot  create  them". I dont understand what is a special file.</p>
  
  <p>Here is my code,</p>
  
  <p>I am trying to read/write the file using creat system call. </p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;fcntl.h&gt;
  #include&lt;sys/types.h&gt;
  #include&lt;sys/stat.h&gt;
  #include&lt;unistd.h&gt;
  #include&lt;errno.h&gt;
  #include&lt;stdlib.h&gt;
  int main()
  {
   int fd;
   int written;
   int bytes_read;
   char buf[]="Hello! Everybody";
   char out[10];
   printf("Buffer String : %s\n",buf);
   fd=creat("output",S_IRWXU);
   if( -1 == fd)
   {
    perror("\nError opening output file");
    exit(0);
   }
  
   written=write(fd,buf,5);
   if( -1 == written)
   {
    perror("\nFile Write Error");
    exit(0);
   }
   close(fd);
   fd=creat("output",S_IRWXU);
  
   if( -1 == fd)
   {
    perror("\nfile read error\n");
    exit(0);
   }
   bytes_read=read(fd,out,20);
   printf("\n--&gt;%s\n",out);
   return 0;
  }
  </code></pre>
  
  <p>I expted the content "Hello" to printed in the file "output". The file created successfully. But content is empty</p>