Menu

striptrailingext

Mark Hobley

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.


Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.