Mode is used to set the default permissions when creating a file. The following example will create a file with read and write permissions for user, group and other (UGO).
open(path, O_RDWR | O_CREAT, 0666);
Read the manual page of chmod to find out how all those numbers work.
|