title: The execution of open when using O_CREAT
body: <p>I'm trying to understand some of the basics of os and I got stuck between flags and permissions.</p>
  
  <p>If <code>open()</code> is used the follofing way
  <code>int fd = open(path, O_CREAT | O_RDWR, 0000);</code>
  in which conditions our file will have 0000 permissions and in which conditions our file will have 0666 conditions ?</p>
  
  <p>At first I thought that if the file is already created, we will use it with 0000 permissions and if it's not created, will be created and used with 0666 permissions. I'm not really sure if i'm correct.</p>