cpl/cpl_path.cpp
const char *CPLGetExtension( const char *pszFullFilename )

{
    size_t  iFileStart = CPLFindFilenameStart( pszFullFilename );
    size_t  iExtStart;
    char    *pszStaticResult = CPLGetStaticResult();

    for( iExtStart = strlen(pszFullFilename);
         iExtStart > iFileStart && pszFullFilename[iExtStart] != '.';
         iExtStart-- ) {}

    if( iExtStart == iFileStart )
        iExtStart = strlen(pszFullFilename)-1;

    strncpy( pszStaticResult, pszFullFilename+iExtStart+1, CPL_PATH_BUF_SIZE );
    pszStaticResult[CPL_PATH_BUF_SIZE - 1] = '\0';

    return pszStaticResult;
}
/**
 * Extract filename extension from full filename.
 *
 * Returns a string containing the extention portion of the passed
 * name.  If there is no extension (the filename has no dot) an empty string
 * is returned.  The returned extension will not include the period.
 *
 * <pre>
 * CPLGetExtension( "abc/def.xyz" ) == "xyz"
 * CPLGetExtension( "abc/def" ) == ""
 * </pre>
 *
 * @param pszFullFilename the full filename potentially including a path.
 *
 * @return just the extension portion of the path in
 * an internal string which must not be freed.  The string
 * may be destroyed by the next CPL filename handling call.
 */
Extract filename extension from full filename.
Returns a string containing the extention portion of the passed
name.  If there is no extension (the filename has no dot) an empty string
is returned.  The returned extension will not include the period.



@param pszFullFilename the full filename potentially including a path.

@return just the extension portion of the path in
an internal string which must not be freed.  The string
may be destroyed by the next CPL filename handling call.
Extract filename extension from full filename . Returns a string containing the extention portion of the passed name . If there is no extension ( the filename has no dot ) an empty string is returned . The returned extension will not include the period . @param pszFullFilename the full filename potentially including a path . @return just the extension portion of the path in an internal string which must not be freed . The string may be destroyed by the next CPL filename handling call .
const char *CPLGetExtension( const char *pszFullFilename )
{
    size_t  iFileStart = CPLFindFilenameStart( pszFullFilename );
    size_t  iExtStart;
    char    *pszStaticResult = CPLGetStaticResult();
    for( iExtStart = strlen(pszFullFilename);
         iExtStart > iFileStart && pszFullFilename[iExtStart] != '.';
         iExtStart-- ) {}
    if( iExtStart == iFileStart )
        iExtStart = strlen(pszFullFilename)-1;
    strncpy( pszStaticResult, pszFullFilename+iExtStart+1, CPL_PATH_BUF_SIZE );
    pszStaticResult[CPL_PATH_BUF_SIZE - 1] = '\0';
    return pszStaticResult;
}
const char * CPLGetExtension ( const char * pszFullFilename ) { size_t iFileStart = CPLFindFilenameStart ( pszFullFilename ) ; size_t iExtStart ; char * pszStaticResult = CPLGetStaticResult ( ) ; for ( iExtStart = strlen ( pszFullFilename ) ; iExtStart > iFileStart && pszFullFilename [ iExtStart ] != ' ' ; iExtStart -- ) { } if ( iExtStart == iFileStart ) iExtStart = strlen ( pszFullFilename ) - 1 ; strncpy ( pszStaticResult , pszFullFilename + iExtStart + 1 , CPL_PATH_BUF_SIZE ) ; pszStaticResult [ CPL_PATH_BUF_SIZE - 1 ] = ' \0 ' ; return pszStaticResult ; }
Extract filename extension from full filename.
Extract filename extension from full filename .