Node:File creation, Previous:Opening files at a low level, Up:Opening files at a low level

File creation

In older C code using low-level file routines, there was a function called creat that was used for creating files. This function is still included in GNU for compatibility with older C code, but is considered obsolete. In order to create a file, instead of writing

creat (filename)

it is now considered better coding to practice to write the following code:

open (filename, O_WRONLY | O_CREAT | O_TRUNC)