Next: , Previous: File Directory, Up: File Directory


8.1 base_name

Remove the prefix and optionally a suffix of a string.

Synopsis

     #include <suplib/file.h>
     
     
     
char *base_name( char *string, char *suffix );

Parameters

char *string
the string to process
char *suffix
an optional suffix to remove. Set it to NULL to do nothing

Description

base_name removes all but the last level in a path (the file name) and, optionally, a suffix. The former is accomplished by returning a pointer to the first character in the filename. The latter is accomplished by writing an end of string character into the string.

Returns

It returns a pointer to the beginning of the filename.

Author

Diab Jerius