本文整理汇总了C++中IF_FileSystem::pathCreateUniqueName方法的典型用法代码示例。如果您正苦于以下问题:C++ IF_FileSystem::pathCreateUniqueName方法的具体用法?C++ IF_FileSystem::pathCreateUniqueName怎么用?C++ IF_FileSystem::pathCreateUniqueName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IF_FileSystem
的用法示例。
在下文中一共展示了IF_FileSystem::pathCreateUniqueName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createUniqueFile
/****************************************************************************
Desc: Creates a new 64-bit file with a unique, generated name
****************************************************************************/
RCODE F_MultiFileHdl::createUniqueFile(
const char * pszPath, // Directory where the file is to be created
const char * pszFileExtension) // Extension to be used on the new file.
{
RCODE rc = NE_FLM_OK;
FLMUINT uiCount;
FLMBOOL bModext = TRUE;
FLMBOOL bCreatedDir = FALSE;
FLMUINT uiBaseTime = 0;
FLMBYTE ucHighByte = 0;
char szDirName[ F_FILENAME_SIZE];
char szTmpPath[ F_PATH_MAX_SIZE];
char szBasePath[ F_PATH_MAX_SIZE];
IF_FileSystem * pFileSystem = f_getFileSysPtr();
if( m_bOpen)
{
rc = RC_SET_AND_ASSERT( NE_FLM_FAILURE);
goto Exit;
}
if( !pszPath || pszPath[ 0] == '\0')
{
#if defined( FLM_UNIX)
f_strcpy( szBasePath, "./");
#elif defined( FLM_NLM)
f_strcpy( szBasePath, "SYS:_NETWARE");
#else
szBasePath[ 0] = '\0';
#endif
}
else
{
f_strcpy( szBasePath, pszPath);
}
if ((pszFileExtension) && (f_strlen( pszFileExtension) >= 3))
{
bModext = FALSE;
}
uiCount = 0;
szDirName[ 0] = '\0';
do
{
pFileSystem->pathCreateUniqueName( &uiBaseTime, szDirName,
pszFileExtension, &ucHighByte, bModext);
f_strcpy( szTmpPath, szBasePath);
pFileSystem->pathAppend( szTmpPath, szDirName);
rc = pFileSystem->createDir( szTmpPath);
} while ((rc != NE_FLM_OK) && (uiCount++ < 20));
if( RC_BAD( rc))
{
goto Exit;
}
f_strcpy( m_szPath, szTmpPath);
bCreatedDir = TRUE;
// Create the lock file
if( RC_BAD( rc = createLockFile( m_szPath)))
{
goto Exit;
}
// Initialize the EOF to 0 and set the state to open
m_ui64EOF = 0;
m_bOpen = TRUE;
Exit:
// Release the lock file
if( RC_BAD( rc))
{
releaseLockFile( m_szPath, TRUE);
if( bCreatedDir)
{
(void)pFileSystem->removeDir( m_szPath);
}
}
return( rc);
}