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


C++ CFileIO类代码示例

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


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

示例1: WriteToFile

void Generator::WriteToFile(CFileIO &fIO)
{
	fIO.WriteBinary(&iEntType,1);
	fIO.WriteBinary(&ScrollOffset,1);
	fIO.WriteBinary(&Pos.x,1);
	fIO.WriteBinary(&Pos.y,1);
	fIO.WriteBinary(&numEnts,1);
	fIO.WriteBinary(&tickDelay,1);
	mpEntity->WriteToFile(fIO);
}
开发者ID:ptitSeb,项目名称:prototype,代码行数:10,代码来源:Generator.cpp

示例2: Load_FileIO

BOOL CScanner::Load_FileIO( LPCTSTR lpszFileName, BOOL bMultiByte )
{
	CFileIO file;
	CString fileName = lpszFileName;
	fileName.MakeLower();
	if( !file.Open(lpszFileName, "rb" ) ) 
		return 0;
	m_strFileName = lpszFileName;
	return Read( &file, bMultiByte );
}
开发者ID:iceberry,项目名称:flyffsf,代码行数:10,代码来源:scanner.cpp

示例3: CreateFile

void CTest::CreateFile(const string& path, size_t offset, size_t size)
{
    CFileIO fio;
    fio.Open(path, CFileIO::eCreate, CFileIO::eReadWrite);
    assert((offset + size) <= m_BufLen);
    size_t n = fio.Write(m_Buf + offset, size);
    assert(n == size);
    fio.Close();
    assert(CFile(path).Exists());
}
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:10,代码来源:test_compress_archive.cpp

示例4: LoadFromFile

void Generator::LoadFromFile(CFileIO &fIO)
{
	fIO.ReadBinary(&iEntType,1);
	fIO.ReadBinary(&ScrollOffset,1);
	fIO.ReadBinary(&Pos.x,1);
	fIO.ReadBinary(&Pos.y,1);
	fIO.ReadBinary(&numEnts,1);
	fIO.ReadBinary(&tickDelay,1);
	if(!(mpEntity = gpEngine->CreateEntity(iEntType)))
		return;
	mpEntity->LoadFromFile(fIO);
}
开发者ID:ptitSeb,项目名称:prototype,代码行数:12,代码来源:Generator.cpp

示例5: node_id_file

// The method is called after the database is created or loaded.
// This guarantees that the directory is there.
// The file with an identifier could be read or created safely.
// Returns: true if everything is fine.
void CNetScheduleServer::InitNodeID(const string &  db_path)
{
    CFile   node_id_file(CFile::MakePath(
                            CDirEntry::AddTrailingPathSeparator(db_path),
                            "NODE_ID"));

    if (node_id_file.Exists()) {
        // File exists, read the ID from it
        CFileIO     f;
        char        buffer[64];

        f.Open(node_id_file.GetPath(), CFileIO_Base::eOpen,
                                       CFileIO_Base::eRead);
        size_t      n = f.Read(buffer, sizeof(buffer));

        m_NodeID = string(buffer, n);
        NStr::TruncateSpacesInPlace(m_NodeID, NStr::eTrunc_End);
        f.Close();
    } else {
        // No file, need to be created
        m_NodeID = "n" + x_GenerateGUID();

        CFileIO     f;
        f.Open(node_id_file.GetPath(), CFileIO_Base::eCreate,
                                       CFileIO_Base::eReadWrite);
        f.Write(m_NodeID.data(), m_NodeID.size());
        f.Close();
    }
}
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:33,代码来源:ns_server.cpp

示例6: WriteBufferToFile

void ControlledEntity::WriteBufferToFile(CFileIO &fIO)
{
	int bufsize = (int)mKeyBuffer.size();
	fIO.WriteBinary(&bufsize,1);
	if(bufsize>0)
	{
		list<keyBuffer>::iterator i;
		for(i = mKeyBuffer.begin(); i != mKeyBuffer.end(); i++)
		{
			fIO.WriteBinary(&(*i).tick,1);
			fIO.WriteBinary(&(*i).KeyStateChange,1);
			fIO.WriteBinary(&(*i).KeyStates,1);
		}
	}
}
开发者ID:ppiecuch,项目名称:Prototype,代码行数:15,代码来源:Entity.cpp

示例7: ReadBufferFromFile

void ControlledEntity::ReadBufferFromFile(CFileIO &fIO)
{
	int bufsize,n;
	fIO.ReadBinary(&bufsize,1);
	if(bufsize>0)
	{
		for(n=0;n<bufsize;n++)
		{
			keyBuffer kb;
			fIO.ReadBinary(&kb.tick,1);
			fIO.ReadBinary(&kb.KeyStateChange,1);
			fIO.ReadBinary(&kb.KeyStates,1);
			mKeyBuffer.push_back(kb);
		}
	}
}
开发者ID:ppiecuch,项目名称:Prototype,代码行数:16,代码来源:Entity.cpp

示例8: LoadDemo

bool LoadDemo(demoSystem& dem, int demo)
{
	char name[256];
	sprintf(name,"Data/Demo%i.dem",demo);
	dem.mKeyBuffer.clear();
	CFileIO fIO;
	if(!fIO.GetFile(name,"rb"))
		return false;
	fIO.ReadBinary(&dem.iScrollOffset,1);

	int bufsize,n;
	fIO.ReadBinary(&bufsize,1);
	if(bufsize>0)
	{
		for(n=0;n<bufsize;n++)
		{
			keyBuffer kb;
			fIO.ReadBinary(&kb.tick,1);
			fIO.ReadBinary(&kb.KeyStateChange,1);
			fIO.ReadBinary(&kb.KeyStates,1);
			dem.mKeyBuffer.push_back(kb);
		}
	}
	return true;
}
开发者ID:RangerKarl,项目名称:Prototype,代码行数:25,代码来源:Demo.cpp

示例9: ClearMapArrays

//================================================================================================//
bool Engine::LoadMapData()
{
	char sz[256];
	ClearMapArrays();
	ClearMapEntities();

	CFileIO fIO;
	sprintf(sz,"Data/Maps/Stage%i.stg",iStage);
	if(!fIO.GetFile(sz,"rb"))
		return false;
	int x,y;
	//read block data
	for(x=0;x<400;x++)
	{
		for(y=0;y<15;y++)
		{
			fIO.ReadBinary(&mTilesLayer1[x][y].ID,1);
			fIO.ReadBinary(&mTilesLayer1[x][y].properties,1);
			fIO.ReadBinary(&mTilesLayer2[x][y].ID,1);
			fIO.ReadBinary(&mTilesLayer2[x][y].properties,1);
			fIO.ReadBinary(&mTilesLayer3[x][y].ID,1);
			fIO.ReadBinary(&mTilesLayer3[x][y].properties,1);
		}
	}
	//read entities
	int numEnt,n;
	fIO.ReadBinary(&numEnt,1);
	for(n=0;n<numEnt;n++)
	{
		Generator g;
		g.LoadFromFile(fIO);
		mGenerators.push_back(g);
	}
	fIO.ReadBinary(&numEnt,1);
	for(n=0;n<numEnt;n++)
	{
		AnimGenerator g;
		g.LoadFromFile(fIO);
		mAnimGenerators.push_back(g);
	}
	return true;
}
开发者ID:RangerKarl,项目名称:Prototype,代码行数:43,代码来源:Engine.cpp

示例10: printf

void CLog::Write( const std::string sLog )
{
	printf( sLog.c_str() );

	// ログ出力モードになっているかをチェック
	if( !IsWrite() )	return;
	// 今日の日付でファイルを作成する
	struct tm *date;
	time_t now;
	time(&now);
	date = localtime(&now);

	// ファイル名
	char buffa[_MAX_PATH];
	SHGetSpecialFolderPath(NULL, buffa, CSIDL_DESKTOPDIRECTORY, FALSE);
	sprintf_s( buffa, _MAX_PATH, "%s\\%04d%02d%02d.log", buffa, date->tm_year + 1900, date->tm_mon + 1 , date->tm_mday );

	std::ostringstream os;
	os << std::setw(2) << date->tm_hour << ":" << std::setw(2) << date->tm_min << "\t" << sLog;

	CFileIO io;
	io.Write( os.str(), std::ios::app, buffa );
}
开发者ID:i-Seiza,项目名称:SoftwareController,代码行数:23,代码来源:Log.cpp

示例11: SaveDemo

void SaveDemo(demoSystem dem)
{
	CFileIO fIO;
	fIO.GetFile("Data/Demo1.dem","wb");
	fIO.WriteBinary(&dem.iScrollOffset,1);
	int bufsize = (int)dem.mKeyBuffer.size();
	fIO.WriteBinary(&bufsize,1);
	if(bufsize>0)
	{
		list<keyBuffer>::iterator i;
		for(i = dem.mKeyBuffer.begin(); i != dem.mKeyBuffer.end(); i++)
		{
			fIO.WriteBinary(&(*i).tick,1);
			fIO.WriteBinary(&(*i).KeyStateChange,1);
			fIO.WriteBinary(&(*i).KeyStates,1);
		}
	}
}
开发者ID:RangerKarl,项目名称:Prototype,代码行数:18,代码来源:Demo.cpp

示例12: LoadFromFile

void FireBug::LoadFromFile(CFileIO &fIO)
{
	fIO.ReadBinary(&RateofFire,1);
	fIO.ReadBinary(&bStartMovement,1);
}
开发者ID:RangerKarl,项目名称:Prototype,代码行数:5,代码来源:firebug.cpp

示例13: WriteToFile

void SuperTurret::WriteToFile(CFileIO &fIO)
{
	fIO.WriteBinary(&bDirection,1);
}
开发者ID:RangerKarl,项目名称:Prototype,代码行数:4,代码来源:SuperTurret.cpp

示例14: WriteToFile

void Serpent::WriteToFile(CFileIO &fIO)
{
	fIO.WriteBinary(&RateofFire,1);
	fIO.WriteBinary(&bStartDirection,1);
	WriteBufferToFile(fIO);
}
开发者ID:fabiensanglard,项目名称:Prototype,代码行数:6,代码来源:Serpent.cpp

示例15: LoadFromFile

void BreakScenery::LoadFromFile(CFileIO &fIO)
{
	fIO.ReadBinary(&frame,1);
	fIO.ReadBinary(&iRotation,1);
	spr = gpEngine->sprBreak1;
}
开发者ID:RangerKarl,项目名称:Prototype,代码行数:6,代码来源:BreakScenery.cpp


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