Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
As described earlier, open() apparently opens existing files only. This section describes how brand-new files are created. There are two choices: creat() and open() with additional flags. Initially, creat() was the only way to create a file, but open() was later enhanced with this functionality as well. Both mechanisms require specification of the initial file permissions.
As a GNU/Linux user, you are familiar with file permissions as printed by ’ls -l’: read, write, and execute for each of user (the file’s owner), group, and other. The various combinations are often expressed in octal, particularly for the chmod and umask commands. For example, file permissions -rw-r--r-- is equivalent to octal 0644 and -rwxr-xr-x is equivalent to octal 0755. (The leading 0 is C’s notation for octal values.)