The File System Interface
Let's look at the interface provided by the file system to the users, in this lesson.
We'll cover the following
Let’s now discuss the file system interface in more detail. We’ll start with the basics of creating, accessing, and deleting files. You may think this is straightforward, but along the way we’ll discover the mysterious call that is used to remove files, known as unlink()
. Hopefully, by the end of this chapter, this mystery won’t be so mysterious to you!
Creating files
We’ll start with the most basic of operations: creating a file. This can be accomplished with the open
system call; by calling open()
and passing it the O_CREAT
flag, a program can create a new file. Here is some example code to create a file called “foo” in the current working directory:
Get hands-on with 1400+ tech skills courses.