Paths

A path is nothing more than a string that represents a node in a filesystem. On UNIX systems, this is usually a string consisting of a series of directory names, /, and a filename, usually with an extension. The purpose of a path is to represent the name and location of a file, which can then be used to perform an action on the file such as opening the file for reading and writing, changing the file's permissions, or even removing the file from the filesystem.

It should be noted that a path can represent many different types of nodes in a filesystem, including files, directories, links, devices, and so on. A more complete list will be presented later in this chapter. Consider the following example:

/home/user/

This is a path that refers ...

Get Hands-On System Programming with C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.