It returns a NULL-terminated string, and you can use strlen to determine the length of that string (after a typecast to const char *). Just don't copy it into a pre-allocated buffer. You can also use a 3rd-party extension handling library like Roland suggests.
Also, a simple substring search isn't good, because nothing prevents an extension name from being an exact subset of another extension name. I already had a piece of code that takes a string and a separator as input, and returns a dynamically allocated array of strings as ouput, so I just use that with the extensions string and space.
Also, a simple substring search isn't good, because nothing prevents an extension name from being an exact subset of another extension name. I already had a piece of code that takes a string and a separator as input, and returns a dynamically allocated array of strings as ouput, so I just use that with the extensions string and space.