Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

The GNU C Programming Tutorial - File creation

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)

 
 
  Published under free license. Design by Interspire