File and Path Function
char *basename(const char *filename);
char *basename(char *path);
char *dirname(char *path);
Internationalization (I18n) Function Overview
The GNU (const char*) version of the basename function returns the
last component of the path in filename . This function is the preferred usage if
available, since it does not modify the argument, filename , and respects trailing
slashes.
The standard (char*) version of the basename function is similar
in spirit to the GNU version, but may modify the path by removing trailing
'/' characters. If the path is made up entirely of '/'
characters, then "/" will be returned. Also, if path is NULL
or an empty string, then "." is returned.
The dirname function is the compliment to the XPG version of basename .
It returns the parent directory of the file specified by path . If path
is NULL , an empty string, or contains no '/' characters, then
"." is returned.
I18n Issues
On ANSI UTF-16 platforms, use a conversion function to convert the
wide-character string to a multibyte-character string and then call basename or dirname .
See Pathnames for a discussion of path and filename considerations in
an internationalized application.
Recommended Replacements*
*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.
File and Path Functions
|