cpl/cpl_path.cpp
char *CPLGetCurrentDir()

{
    size_t  nPathMax;
    char    *pszDirPath;

# ifdef _MAX_PATH
    nPathMax = _MAX_PATH;
# elif PATH_MAX
    nPathMax = PATH_MAX;
# else
    nPathMax = 8192;
# endif

    pszDirPath = (char*)CPLMalloc( nPathMax );
    if ( !pszDirPath )
        return NULL;

#ifdef HAVE_GETCWD
    return getcwd( pszDirPath, nPathMax );
#else
    return NULL;
#endif /* HAVE_GETCWD */
}
/**
 * Get the current working directory name.
 *
 * @return a pointer to buffer, containing current working directory path
 * or NULL in case of error.  User is responsible to free that buffer
 * after usage with CPLFree() function.
 * If HAVE_GETCWD macro is not defined, the function returns NULL.
 **/
Get the current working directory name.
@return a pointer to buffer, containing current working directory path
or NULL in case of error.  User is responsible to free that buffer
after usage with CPLFree() function.
If HAVE_GETCWD macro is not defined, the function returns NULL.
Get the current working directory name . @return a pointer to buffer containing current working directory path or NULL in case of error . User is responsible to free that buffer after usage with CPLFree () function . If HAVE_GETCWD macro is not defined the function returns NULL .
char *CPLGetCurrentDir()
{
    size_t  nPathMax;
    char    *pszDirPath;
# ifdef _MAX_PATH
    nPathMax = _MAX_PATH;
# elif PATH_MAX
    nPathMax = PATH_MAX;
# else
    nPathMax = 8192;
# endif
    pszDirPath = (char*)CPLMalloc( nPathMax );
    if ( !pszDirPath )
        return NULL;
#ifdef HAVE_GETCWD
    return getcwd( pszDirPath, nPathMax );
#else
    return NULL;
#endif 
}
char * CPLGetCurrentDir ( ) { size_t nPathMax ; char * pszDirPath ; # ifdef _MAX_PATH nPathMax = _MAX_PATH ; # elif PATH_MAX nPathMax = PATH_MAX ; # else nPathMax = 8192 ; # endif pszDirPath = ( char * ) CPLMalloc ( nPathMax ) ; if ( ! pszDirPath ) return NULL ; #ifdef HAVE_GETCWD return getcwd ( pszDirPath , nPathMax ) ; #else return NULL ; #endif }
Get the current working directory name.
Get the current working directory name .
/* HAVE_GETCWD */