pathlib Wiki
Library of pathname and filename manipulation tools
Status: Alpha
Brought to you by:
markhobley
Synopsis
char * striptrailingext(char *pathname);
Strips trailing filename extension leaving:
./a.out becomes: ./a
Return values
Returns address of base filename (or NULL if no file extension was provided or an error occurs).
Memory allocation
This function allocates memory (at the returned address) to hold the revised filename. This will need be deallocated by the calling function after use.
Note that if the provided pathname does not contain a file extension, then no memory is allocated and a NULL pointer is returned.