本文整理汇总了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);
}
示例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 );
}
示例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());
}
示例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);
}
示例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();
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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 );
}
示例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);
}
}
}
示例12: LoadFromFile
void FireBug::LoadFromFile(CFileIO &fIO)
{
fIO.ReadBinary(&RateofFire,1);
fIO.ReadBinary(&bStartMovement,1);
}
示例13: WriteToFile
void SuperTurret::WriteToFile(CFileIO &fIO)
{
fIO.WriteBinary(&bDirection,1);
}
示例14: WriteToFile
void Serpent::WriteToFile(CFileIO &fIO)
{
fIO.WriteBinary(&RateofFire,1);
fIO.WriteBinary(&bStartDirection,1);
WriteBufferToFile(fIO);
}
示例15: LoadFromFile
void BreakScenery::LoadFromFile(CFileIO &fIO)
{
fIO.ReadBinary(&frame,1);
fIO.ReadBinary(&iRotation,1);
spr = gpEngine->sprBreak1;
}