Skip to content

sptop_of

Category: path
GitHub: cute_file_system.h


Returns the top-level directory of a given file or directory. Returns a new string.

#define sptop_of(s) cf_path_top_directory(s)
Parameters Description
s The path string.

Code Example

Example fetching a the top-level directory a file sits within.

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

Remarks

sp stands for "sting path". Call sfree on the return value when done.

spfname
spfname_no_ext
spext
spext_equ
sppop
sppopn
spcompact
spdir_of
spnorm