basename()

return the base name of a path name 

Function


SYNOPSIS

#include <libgen.h>

char *basename(char *path);


DESCRIPTION

The basename() function takes the specified path name and returns a pointer to the final component of the path name, deleting any terminating directory-separator characters.

If the string consists entirely of directory separator characters, basename() returns a pointer to the string "/".

If the specified path is a null pointer or points to an empty string, basename() returns a pointer to the string ".".

The basename() function may modify the specified string, and may return a pointer to static storage that may be overwritten by a subsequent call to basename().


PARAMETERS

path 

Is the path name from which the last component is to be returned.


RETURN VALUES

The basename() function returns a pointer to a string, as specified above.


CONFORMANCE

UNIX 98, with exceptions


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

The NuTCRACKER Platform recognizes both '/' and '\' as directory separators. It looks for the right-most occurrence of either character in the path name, and if both are found, assumes that the last one that occurs in the path name is the directory separator for that path.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
dirname()


PTC MKS Toolkit 10.3 Documentation Build 39.