603 B
603 B
extract_file_ext.c
Get the file extension from a given file path.
Includes
#include <string.h>
#include "utils.h"
Function Description
extract_file_ext
Get the file extension from a given file path.
Parameter
path: The file path string.
Return Value
Returns a pointer to the file extension within the path string, or NULL if
no extension is found.
Implementation
const char *
extract_file_ext(const char *path)
{
const char *dot;
dot = strrchr(path, '.');
if (NULL == dot || dot == path)
return (NULL);
return (dot + 1);
}