当前位置: 首页>>代码示例>>C++>>正文


C++ PathCharString::GetString方法代码示例

本文整理汇总了C++中PathCharString::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ PathCharString::GetString方法的具体用法?C++ PathCharString::GetString怎么用?C++ PathCharString::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PathCharString的用法示例。


在下文中一共展示了PathCharString::GetString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FILEDosToUnixPathA

static
BOOL
RemoveDirectoryHelper (
    PathCharString& lpPathName,
    LPDWORD dwLastError
)
{
    BOOL  bRet = FALSE;
    *dwLastError = 0;

    FILEDosToUnixPathA( lpPathName );

    if ( rmdir(lpPathName) != 0 )
    {
        TRACE("Removal of directory [%s] was unsuccessful, errno = %d.\n",
              lpPathName.GetString(), errno);

        switch( errno )
        {
        case ENOTDIR:
        /* FALL THROUGH */
        case ENOENT:
        {
            struct stat stat_data;

            if ( stat( lpPathName, &stat_data) == 0 &&
                    (stat_data.st_mode & S_IFMT) == S_IFREG )
            {
                /* Not a directory, it is a file. */
                *dwLastError = ERROR_DIRECTORY;
            }
            else
            {
                FILEGetProperNotFoundError( lpPathName, dwLastError );
            }
            break;
        }
        case ENOTEMPTY:
            *dwLastError = ERROR_DIR_NOT_EMPTY;
            break;
        default:
            *dwLastError = ERROR_ACCESS_DENIED;
        }
    }
    else {
        TRACE("Removal of directory [%s] was successful.\n", lpPathName.GetString());
        bRet = TRUE;
    }

    return bRet;
}
开发者ID:Clockwork-Muse,项目名称:coreclr,代码行数:51,代码来源:directory.cpp

示例2: if

/*++
Function:
  GetCurrentDirectoryA

--*/
DWORD
GetCurrentDirectoryA(PathCharString& lpBuffer)
{
    DWORD dwDirLen = 0;
    DWORD dwLastError = 0;

    char  *current_dir;

    PERF_ENTRY(GetCurrentDirectoryA);
    ENTRY("GetCurrentDirectoryA(lpBuffer=%p)\n", lpBuffer.GetString());

    current_dir = lpBuffer.OpenStringBuffer(MAX_PATH);
    /* NULL first arg means getcwd will allocate the string */
    current_dir = PAL__getcwd( current_dir, MAX_PATH);

    if (current_dir != NULL )
    {
        dwDirLen = strlen( current_dir );
        lpBuffer.CloseBuffer(dwDirLen);
        goto done;
    }
    else if ( errno == ERANGE )
    {
        lpBuffer.CloseBuffer(0);
        current_dir = PAL__getcwd( NULL, 0);
    }

    if ( !current_dir )
    {
        WARN("Getcwd failed with errno=%d [%s]\n", errno, strerror(errno));
        dwLastError = DIRGetLastErrorFromErrno();
        dwDirLen = 0;
        goto done;
    }

    dwDirLen = strlen( current_dir );
    lpBuffer.Set(current_dir, dwDirLen);
    PAL_free(current_dir);
done:

    if ( dwLastError )
    {
        SetLastError(dwLastError);
    }

    LOGEXIT("GetCurrentDirectoryA returns DWORD %u\n", dwDirLen);
    PERF_EXIT(GetCurrentDirectoryA);
    return dwDirLen;
}
开发者ID:Clockwork-Muse,项目名称:coreclr,代码行数:54,代码来源:directory.cpp

示例3: if

PALIMPORT
BOOL
PALAPI
PAL_GetPALDirectoryA(
             OUT LPSTR lpDirectoryName,
             IN UINT*  cchDirectoryName)
{
    BOOL bRet;
    PathCharString directory;

    PERF_ENTRY(PAL_GetPALDirectoryA);
    ENTRY( "PAL_GetPALDirectoryA( %p, %d )\n", lpDirectoryName, *cchDirectoryName );

    bRet = PAL_GetPALDirectoryA(directory);

    if (bRet) 
    {
        if (directory.GetCount() > *cchDirectoryName)
        {
            SetLastError( ERROR_INSUFFICIENT_BUFFER );
            bRet = FALSE;
            *cchDirectoryName = directory.GetCount();
        }
        else if (strcpy_s(lpDirectoryName, directory.GetCount(), directory.GetString()) == SAFECRT_SUCCESS) 
        {
        }
        else 
        {
            bRet = FALSE;
        }
    }

    LOGEXIT( "PAL_GetPALDirectoryA returns BOOL %d.\n", bRet);
    PERF_EXIT(PAL_GetPALDirectoryA);
    return bRet;
}
开发者ID:0-wiz-0,项目名称:coreclr,代码行数:36,代码来源:miscpalapi.cpp


注:本文中的PathCharString::GetString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。