|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
#include <unistd.h> char * basename (const char *fname);
This function returns the basename of the file, which is the last
part of its full name given by fname, with the drive letter and
leading directories stripped off. For example, the basename of
file.ext, and the basename of
foo. Trailing slashes and backslashes are
significant: the basename of
c:/foo/bar/ is an empty string after
the rightmost slash.
This function treats both forward- and backslashes like directory separators, so it can handle file names with mixed styles of slashes.
A pointer into the original file name where the basename starts. Note
that this is not a new buffer allocated with
fname is a NULL pointer, the function will return a NULL pointer.
if (strcmp (basename (file_name), "gcc.exe") == 0) printf ("The file %s is the GNU C/C++ compiler\n", file_name);
|webmaster donations bookstore||delorie software privacy|
|Copyright © 2004 by DJ Delorie||Updated Apr 2004|