title: How can I copy permissions from a file that already exists?
body: <p>I have to write a program in C (on a Unix-like system) and this is my problem:</p>
  
  <p>I have a file (FILE1) and I want to create another file (FILE2) which has the same permissions of FILE1. Then I have to create another file (FILE3) which has the same permissions of FILE1 but only for the owner.</p>
  
  <p>I would use chmod() to change permissions but I don't understand how to obtain the permissions of FILE1.</p>
  
  <p>Can you please help me?</p>