本文整理汇总了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;
}
示例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;
}
示例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;
}