Skip to content

cf_path_get_filename

Category: path
GitHub: cute_string.h


Returns the filename portion of a path. Returns a new string.

#define cf_path_get_filename(path) spfname(path)
Parameters Description
path The path string.

Return Value

Returns a new dynamic string. Free with sfree.

Code Example

Example fetching a filename from a path.

const char* filename = spfname("/data/collections/rare/big_gem.txt");
printf("%s\n", filename);
// Prints: big_gem.txt

Remarks

Shortform: spfname(path).

cf_path_get_filename_no_ext
cf_path_get_ext
cf_path_directory_of
cf_path_normalize