Is Basename Thread Safe?

The basename() function need not be thread-safe.

Is basename a Posix?

With glibc, one gets the POSIX version of basename() when <libgen. h> is included, and the GNU version otherwise.

What does basename return?

The basename() function takes the pathname pointed to by path and returns a pointer to the final component of the pathname, deleting any trailing '/' characters. If the string consists entirely of the '/' character, basename() returns a pointer to the string “/”.

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.