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


C++ IF_FileSystem类代码示例

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


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

示例1: releaseLockFile

	FINLINE void releaseLockFile(
		const char *		pszBasePath,
		FLMBOOL				bDelete)
	{
#ifndef FLM_UNIX
		F_UNREFERENCED_PARM( bDelete);
		F_UNREFERENCED_PARM( pszBasePath);
#endif

		if( m_pLockFileHdl)
		{

			// Release the lock file

			(void)m_pLockFileHdl->closeFile();
			m_pLockFileHdl->Release();
			m_pLockFileHdl = NULL;

#ifdef FLM_UNIX
			if( bDelete)
			{
				IF_FileSystem *	pFileSystem = f_getFileSysPtr();
				char					szTmpPath[ F_PATH_MAX_SIZE];

				// Delete the lock file

				f_strcpy( szTmpPath, pszBasePath);
				pFileSystem->pathAppend( szTmpPath, "64.LCK");
				pFileSystem->deleteFile( szTmpPath);
			}
#endif
		}
	}
开发者ID:ajumi2,项目名称:libflaim,代码行数:33,代码来源:ftkmfh.cpp

示例2: f_getFileSysPtr

RCODE FTKAPI F_DirHdl::next( void)
{
	char					szFoundPath[ F_PATH_MAX_SIZE];
	char					szDummyPath[ F_PATH_MAX_SIZE];
	FLMUINT				uiSearchAttributes;
	FLMUINT				uiFoundAttrib;
	IF_FileSystem *	pFileSystem = f_getFileSysPtr();

	if( RC_BAD( m_rc))
	{
		goto Exit;
	}

	uiSearchAttributes =
		F_IO_FA_NORMAL | F_IO_FA_RDONLY | F_IO_FA_ARCHIVE | F_IO_FA_DIRECTORY;

	for( ;;)
	{
		if( m_bFirstTime)
		{
			m_bFirstTime = FALSE;

			if( RC_BAD( m_rc = f_fileFindFirst( m_szDirectoryPath, 
				uiSearchAttributes, &m_FindData, szFoundPath, &uiFoundAttrib)))
			{
				goto Exit;
			}
			
			m_bFindOpen = TRUE;
			m_uiAttrib = uiFoundAttrib;
		}
		else
		{
			if( RC_BAD( m_rc = f_fileFindNext( &m_FindData, 
				szFoundPath, &uiFoundAttrib)))
			{
				goto Exit;
			}
			
			m_uiAttrib = uiFoundAttrib;
		}

		if( RC_BAD( m_rc = pFileSystem->pathReduce( szFoundPath, 
			szDummyPath, m_szFileName)))
		{
			goto Exit;
		}

		if( pFileSystem->doesFileMatch( m_szFileName, m_szPattern))
		{
			break;
		}
	}

Exit:

	return( m_rc);
}
开发者ID:Tyrion-Lannister-274AL,项目名称:flaim,代码行数:58,代码来源:ftkdir.cpp

示例3: dataFilePath

	FINLINE void dataFilePath(
		FLMUINT		uiFileNum,
		char *		pszPath)
	{
		char					szFileName[ 13];
		IF_FileSystem *	pFileSystem = f_getFileSysPtr();

		f_strcpy( pszPath, m_szPath);
		formatFileNum( uiFileNum, szFileName);
		pFileSystem->pathAppend( pszPath, szFileName);
	}
开发者ID:ajumi2,项目名称:libflaim,代码行数:11,代码来源:ftkmfh.cpp

示例4: f_fileFindNext

RCODE f_fileFindNext(
	F_IO_FIND_DATA *	pFindData,
	char *				pszFoundPath,
	FLMUINT *			puiFoundAttrib)
{
	RCODE					rc = NE_FLM_OK;
	IF_FileSystem *	pFileSystem = f_getFileSysPtr();

   if( FindNextFile( pFindData->findHandle,
		&(pFindData->findBuffer)) == FALSE)
	{
		rc = f_mapPlatformError( GetLastError(), NE_FLM_READING_FILE);
		goto Exit;
	}

	// Loop until a file with correct attributes is found

	for( ;;)
	{
		if( f_fileMeetsFindCriteria( pFindData))
		{
			break;
		}

		if( FindNextFile( pFindData->findHandle,
			&(pFindData->findBuffer)) == FALSE)
		{
			rc = f_mapPlatformError( GetLastError(), NE_FLM_READING_FILE);
			goto Exit;
		}
	}

	// Append the file name to the path name

	f_strcpy( pszFoundPath, pFindData->szSearchPath);
	
	if( RC_BAD( rc = pFileSystem->pathAppend( pszFoundPath, 
		(char *)pFindData->findBuffer.cFileName)))
	{
		goto Exit;
	}

	// Return the found file attribute

   *puiFoundAttrib = pFindData->findBuffer.dwFileAttributes;

Exit:

   return( rc);
}
开发者ID:Tyrion-Lannister-274AL,项目名称:flaim,代码行数:50,代码来源:ftkdir.cpp

示例5: f_getFileSysPtr

/****************************************************************************
Desc: Creates a new 64-bit "file"
****************************************************************************/
RCODE F_MultiFileHdl::createFile(
	const char *	pszPath)
{
	RCODE					rc = NE_FLM_OK;
	FLMBOOL				bCreatedDir = FALSE;
	IF_FileSystem *	pFileSystem = f_getFileSysPtr();

	if( m_bOpen)
	{
		rc = RC_SET_AND_ASSERT( NE_FLM_FAILURE);
		goto Exit;
	}

	if( RC_BAD( rc = pFileSystem->createDir( pszPath)))
	{
		goto Exit;
	}

	f_strcpy( m_szPath, pszPath);
	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))
	{
		(void)releaseLockFile( m_szPath, TRUE);
		if( bCreatedDir)
		{
			(void)pFileSystem->removeDir( m_szPath);
		}
	}

	return( rc);
}
开发者ID:ajumi2,项目名称:libflaim,代码行数:51,代码来源:ftkmfh.cpp

示例6: f_getFileSysPtr

/****************************************************************************
Desc:	Read the ini file and parse its contents
****************************************************************************/
RCODE FTKAPI F_IniFile::read(
	const char *		pszFileName)
{
	RCODE					rc = NE_FLM_OK;
	FLMBOOL				bMore = FALSE;
	FLMBOOL				bEOF = FALSE;
#define INITIAL_READ_BUF_SIZE	100
	FLMUINT				uiReadBufSize = 0;
	FLMUINT				uiBytesAvail = 0;
	FLMUINT				uiBytesInLine = 0;
	char *				pszReadBuf = NULL;
	FLMUINT				uiLineNum = 0;
	IF_FileSystem *	pFileSystem = f_getFileSysPtr();
	
	f_assert( m_bReady);
	f_assert( !m_pFileHdl);

	// Open the file

	if (RC_BAD( rc = f_alloc( f_strlen( pszFileName) + 1, &m_pszFileName)))
	{
		goto Exit;
	}

	f_strcpy( m_pszFileName, pszFileName);

	// It's not an error if the file doesn't exist.  If it does exist,
	// we'll read in its data.
	
	if( RC_BAD( pFileSystem->openFile( pszFileName, 
		FLM_IO_RDONLY, &m_pFileHdl)))
	{		
		goto Exit;
	}

	m_uiFileOffset = 0;

	// Read in and parse the file
	
	uiReadBufSize = INITIAL_READ_BUF_SIZE;
	if (RC_BAD( rc = f_alloc( uiReadBufSize, &pszReadBuf)))
	{
		goto Exit;
	}

	// Read in and parse each line in the file...
	while (!bEOF)
	{
		uiLineNum++;

		uiBytesAvail = uiReadBufSize;
		if( RC_BAD( rc = readLine( pszReadBuf, &uiBytesAvail, &bMore)) &&
			 rc != NE_FLM_IO_END_OF_FILE)
		{
			goto Exit;
		}
		
		if (rc == NE_FLM_IO_END_OF_FILE)
		{
			bEOF = TRUE;
		}
		
		// While there are more bytes in the line, re-alloc the buffer, and do
		// another read.
		
		uiBytesInLine = uiBytesAvail;
		while( bMore)
		{
			uiBytesAvail = uiReadBufSize;
			uiReadBufSize *= 2;

			if (RC_BAD( rc = f_realloc( uiReadBufSize, &pszReadBuf)))
			{
				goto Exit;
			}
			
			if (RC_BAD( rc = readLine( pszReadBuf+uiBytesAvail,
												&uiBytesAvail,	&bMore))	&&
				 (rc != NE_FLM_IO_END_OF_FILE) )
			{
				goto Exit;
			}
			
			if( rc == NE_FLM_IO_END_OF_FILE)
			{
				bEOF = TRUE;
			}
			uiBytesInLine += uiBytesAvail;
		}
		
		if ( (RC_OK( rc) || (rc == NE_FLM_IO_END_OF_FILE)) &&
				(uiBytesInLine > 0) )
		{
			// NumBytes will be 0 if the line was blank.  No need
			// to call parseBuffer in this case
			
			if (RC_BAD( rc = parseBuffer( pszReadBuf, uiBytesInLine)))
//.........这里部分代码省略.........
开发者ID:Tyrion-Lannister-274AL,项目名称:flaim,代码行数:101,代码来源:ftkini.cpp

示例7: createUnitTest

/****************************************************************************
Desc:
****************************************************************************/
RCODE createUnitTest(
	const char *		configPath, 
	const char *		buildNum, 
	const char *		environment,  
	const char *		user, 
	unitTestData *		uTD)
{
	RCODE					rc = FERR_OK;
	IF_FileHdl *		pConfigFileHdl = NULL;
	IF_FileHdl *		pCSVFileHdl = NULL;
	FLMBYTE				buffer[ MAX_BUFFER_SIZE] = "";
	FLMUINT				uiSize = MAX_BUFFER_SIZE;
	FLMUINT64			ui64Tmp;
	char *				strPos1 = NULL;
	char *				strPos2 = NULL;
	IF_FileSystem *	pFileSystem = NULL;

	if( !configPath || !buildNum || !environment || !uTD || !user)
	{
		flmAssert(0);
	}

	if( f_strlen(user) > MAX_SMALL_BUFFER_SIZE)
	{
		rc = RC_SET( FERR_CONV_DEST_OVERFLOW);
		goto Exit;
	}
	else
	{
		f_strcpy( uTD->userName, user);
	}

	if( f_strlen(environment) > MAX_SMALL_BUFFER_SIZE)
	{
		rc = RC_SET( FERR_CONV_DEST_OVERFLOW);
		goto Exit;
	}
	else
	{
		f_strcpy( uTD->environment, environment);
	}

	if( f_strlen( buildNum) > MAX_SMALL_BUFFER_SIZE)
	{
		rc = RC_SET( FERR_CONV_DEST_OVERFLOW);
		goto Exit;
	}
	else
	{
		f_strcpy( uTD->buildNumber, buildNum);
	}
	
	if( RC_BAD( rc = FlmGetFileSystem( &pFileSystem)))
	{
		goto Exit;
	}
	
	if( configPath[ 0])
	{
		if( RC_BAD( rc = pFileSystem->openFile(
			configPath, FLM_IO_RDONLY | FLM_IO_SH_DENYNONE, &pConfigFileHdl)))
		{
			goto Exit;
		}
	
		if( RC_BAD( rc = pConfigFileHdl->size( &ui64Tmp)))
		{
			goto Exit;
		}
		
		uiSize = (FLMUINT)ui64Tmp;
		
		if( RC_BAD( rc = pConfigFileHdl->read( 0, uiSize, buffer, &uiSize)))
		{
			goto Exit;
		}
	
		#ifdef FLM_WIN
		{
			char			szTemp[ MAX_BUFFER_SIZE];
			char *		pszTemp = szTemp;
			FLMUINT		uiNewSize = uiSize;
		
			for( unsigned int i = 0; i < uiSize; i++)
			{
				if( ((i + 1) < uiSize) 
					&& (buffer[i] == 0x0D && buffer[ i + 1] == 0x0A))
				{
					*pszTemp++ = 0x0A;
					i++;
					uiNewSize--;
				}
				else
				{
					*pszTemp++ = buffer[ i];
				}
			}
//.........这里部分代码省略.........
开发者ID:ajumi2,项目名称:libflaim,代码行数:101,代码来源:flmunittest.cpp

示例8: f_fileFindFirst

RCODE f_fileFindFirst(
	char *				pszSearchPath,
   FLMUINT				uiSearchAttrib,
	F_IO_FIND_DATA	*	pFindData,
   char *				pszFoundPath,
	FLMUINT *			puiFoundAttrib)
{
	RCODE					rc = NE_FLM_OK;
	char 					szTmpPath[ F_PATH_MAX_SIZE];
	FSTATIC char		pszWildCard[] = {'*',0};
	int					iRetVal;
	IF_FileSystem *	pFileSystem = f_getFileSysPtr();

	if( !pszSearchPath)
	{
		rc = RC_SET( NE_FLM_IO_PATH_NOT_FOUND);
		goto Exit;
	}

	f_strcpy( szTmpPath, pszSearchPath);
	if( RC_BAD( rc = pFileSystem->pathAppend( szTmpPath, pszWildCard)))
	{
		goto Exit;
	}

	f_memset( pFindData, 0, sizeof( F_IO_FIND_DATA));
	if( uiSearchAttrib & F_IO_FA_DIRECTORY)
	{
		pFindData->mode_flag |= S_IFDIR;
	}

	if( uiSearchAttrib & F_IO_FA_RDONLY)
	{
		pFindData->mode_flag |= S_IREAD;
	}

	iRetVal = Find1( (char*)szTmpPath, pFindData);

	if( iRetVal != 0)
	{
		// If there were no more files found then return no more files
		// instead of mapping to error path not found or io error.
		// To return no more files ret_val is ENOENT (set in Find2)
		// and errno is not set

		if( iRetVal == ENOENT && errno == 0)
		{
			rc = RC_SET( NE_FLM_IO_NO_MORE_FILES);
		}
		else
		{
			rc = f_mapPlatformError( errno, NE_FLM_READING_FILE);
		}
		
		goto Exit;
	}

	// filter out ".." (PARENT) and "." (CURRENT) directories
	
	if( uiSearchAttrib & F_IO_FA_DIRECTORY )
	{
		while( (f_strcmp( pFindData->name, "..") == 0) ||
			   (f_strcmp( pFindData->name, ".") == 0))
		{
			if( (iRetVal = Find2( pFindData)) != 0)
			{
				// If there were no more files found then return no more files
				// instead of mapping to error path not found or io error.
				// To return no more files ret_val is ENOENT (set in Find2)
				// and errno is not set
				
				if( iRetVal == ENOENT && errno == 0)
				{
					rc = RC_SET( NE_FLM_IO_NO_MORE_FILES);
				}
				else
				{
					rc = f_mapPlatformError( errno, NE_FLM_READING_FILE);
				}
				
				goto Exit;
			}
		}
	}

	// Append the file name to the path name
	
	f_strcpy( pszFoundPath, pszSearchPath);
	
	if( RC_BAD( rc = pFileSystem->pathAppend( pszFoundPath, 
		(char *)pFindData->name)))
	{
		goto Exit;
	}

	*puiFoundAttrib = (FLMUINT)ReturnAttributes(
			pFindData->FileStat.st_mode, pszFoundPath);

	// Save the search path in the NE_FLM_IO_FIND_DATA struct
	// for a find next call
//.........这里部分代码省略.........
开发者ID:Tyrion-Lannister-274AL,项目名称:flaim,代码行数:101,代码来源:ftkdir.cpp

示例9: dumpToFile

/****************************************************************************
Desc:
*****************************************************************************/
RCODE F_DynamicList::dumpToFile()
{
	RCODE					rc = NE_FLM_OK;
	DLIST_NODE *		pTmp;
	FLMUINT				uiLoop;
	IF_FileHdl *		pFileHdl = NULL;
#define DLST_RESP_SIZE 256
	char					szResponse[ DLST_RESP_SIZE];
	FLMUINT				uiTermChar;
	FTX_SCREEN *		pScreen;
	IF_FileSystem *	pFileSystem = NULL;
	
	if( RC_BAD( rc = FlmGetFileSystem( &pFileSystem)))
	{
		goto Exit;
	}

	f_strcpy( szResponse, (const char *)DLIST_DUMPFILE_PATH);

	FTXWinGetScreen( m_pListWin, &pScreen);
	FTXGetInput(
		pScreen,
 		"enter filename to dump to",
		szResponse,
		DLST_RESP_SIZE-1,
		&uiTermChar);

	if ( uiTermChar != FKB_ENTER)
	{
		goto Exit;
	}

	if (RC_BAD( rc = pFileSystem->doesFileExist( szResponse)))
	{
		//create file if it doesn't already exist
		if ( rc == NE_FLM_IO_PATH_NOT_FOUND)
		{
			rc = pFileSystem->createFile( szResponse, FLM_IO_RDWR, &pFileHdl);
		}
		else
		{
			goto Exit_local;
		}
	}
	else
	{
		rc = pFileSystem->openFile( szResponse, FLM_IO_RDWR, &pFileHdl);
	}

	TEST_RC_LOCAL( rc);

	{
		FLMUINT64	ui64FileSize = 0;
		FLMUINT		uiBytesWritten = 0;

		//figure out size of file currently, so you can append to it
		
		pFileHdl->size( &ui64FileSize);
		pTmp = m_pFirst;

		uiLoop = 0;
		while( pTmp)
		{
			FLMBYTE * pszNextLine = (FLMBYTE*)(pTmp->pvData);

			TEST_RC_LOCAL( rc = pFileHdl->write(
				ui64FileSize,					//offset to current file size
				f_strlen( (const char *)pszNextLine),
				pszNextLine,
				&uiBytesWritten));

			ui64FileSize += uiBytesWritten;

			TEST_RC_LOCAL( rc = pFileHdl->write(
				ui64FileSize,					//add in newline
				1,
				(FLMBYTE*)"\n",
				&uiBytesWritten));

			ui64FileSize += uiBytesWritten;
			pTmp = pTmp->pNext;
		}

		(void)pFileHdl->closeFile();

	}

Exit_local:
	{//give success/fail message

		char				szMessage[ 256];
		FLMUINT			uiChar;

		FTXWinGetScreen( m_pListWin, &pScreen);
		if ( RC_OK( rc))
		{
			f_sprintf( szMessage,
//.........这里部分代码省略.........
开发者ID:Tyrion-Lannister-274AL,项目名称:flaim,代码行数:101,代码来源:flm_dlst.cpp


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