本文整理汇总了C++中CFileStream类的典型用法代码示例。如果您正苦于以下问题:C++ CFileStream类的具体用法?C++ CFileStream怎么用?C++ CFileStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CFileStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrepareSimpleDialog
void CRIFFChunkTreeDlg::OnSave()
{
OPENFILENAME ofn;
PrepareSimpleDialog(&ofn, *this, "*.txt");
ofn.lpstrFilter = "Text files (*.txt)|*.txt||";
ofn.Flags |= OFN_OVERWRITEPROMPT;
if (!GetOpenSaveFileNameUTF8(&ofn, false))
return;
CFileStream* destFile = new CFileStream();
if (STREAM_OK == destFile->Open(ofn.lpstrFile, StreamMode::Write))
{
CACHE* cache = new CACHE(4, 1<<18);
cache->Open(destFile, CACHE_OPEN_WRITE);
cache->Write(cUTF8Hdr, 3);
RenderItem(cache, m_Tree.GetRootItem(), 0);
cache->Close();
delete cache;
destFile->Close();
delete destFile;
}
else
{
MessageBoxHelper::CouldNotOpenFileForWrite(ofn.lpstrFile);
}
}
示例2: LoadSource
//////////////////////////////////////////////////////////////////////
// CShader
//////////////////////////////////////////////////////////////////////
bool CShader::LoadSource(const std::string& filename, const std::string& prefix)
{
if(filename.empty())
return true;
CFileStream file;
std::string path = "special://xbmc/system/shaders/";
path += CServiceBroker::GetRenderSystem()->GetShaderPath(filename);
path += filename;
if(!file.Open(path))
{
CLog::Log(LOGERROR, "CYUVShaderGLSL::CYUVShaderGLSL - failed to open file %s", filename.c_str());
return false;
}
getline(file, m_source, '\0');
size_t pos = 0;
size_t versionPos = m_source.find("#version");
if (versionPos != std::string::npos)
{
versionPos = m_source.find("\n", versionPos);
if (versionPos != std::string::npos)
pos = versionPos + 1;
}
m_source.insert(pos, prefix);
return true;
}
示例3: Load
bool CDungeonConfig::Load(CFileStream&file)
{
file.ReadUInt( m_nDungeonID );
short nCount = 0;
file.ReadShort(nCount) ;
file.ReadString(m_strDungeonName, nCount);
file.ReadShort(nCount) ;
file.ReadString(m_strIconName, nCount);
file.ReadShort(nCount) ;
file.ReadString(m_strIconAtlas, nCount);
file.ReadUInt(m_nStoryID);
unsigned short nParcloseCount = 0;
file.ReadUShort( nParcloseCount );
for ( unsigned int i = 0 ;i < nParcloseCount; ++i )
{
unsigned int nParcloseID = 0;
file.ReadUInt( nParcloseID );
m_ParcloseList.push_back( nParcloseID );
}
return true;
}
示例4: InsertSource
bool CShader::InsertSource(const std::string& filename, const std::string& loc)
{
if(filename.empty())
return true;
CFileStream file;
std::string temp;
std::string path = "special://xbmc/system/shaders/";
path += CServiceBroker::GetRenderSystem()->GetShaderPath(filename);
path += filename;
if(!file.Open(path))
{
CLog::Log(LOGERROR, "CShader::InsertSource - failed to open file %s", filename.c_str());
return false;
}
getline(file, temp, '\0');
size_t locPos = m_source.find(loc);
if (locPos == std::string::npos)
{
CLog::Log(LOGERROR, "CShader::InsertSource - could not find location %s", loc.c_str());
return false;
}
m_source.insert(locPos, temp);
return true;
}
示例5: new
CFileStream* CFileStream::NewL(TDesC& aFileName, TBool aIsWrite)
{
CFileStream* r = new(ELeave) CFileStream(aIsWrite);
CleanupStack::PushL(r);
r->ConstructL(aFileName);
CleanupStack::Pop();
return r;
}
示例6: SavePRM
//???remove from here? make user use readers/writers directly?
void CDataServer::SavePRM(const nString& FileName, PParams Content)
{
if (!Content.isvalid()) return;
CFileStream File;
if (!File.Open(FileName, SAM_WRITE)) return;
CBinaryWriter Writer(File);
Writer.WriteParams(*Content);
}
示例7: SaveMeshToFile
void CGlobalMshLoader::SaveMeshToFile(const CMesh::TMeshContainer &mesh, const nstring &file)
{
CFileStream sfile;
sfile.Open(file, true, false);
SaveMeshToStream(mesh, &sfile);
sfile.Close();
}
示例8: main
int main(int argc, char* argv[])
{
CFileStream stream;
stream.open("./test.txt","wb+");
stream.write("aaa", 3);
stream.close();
return 0;
}
示例9: LoadFromFile
void CLuckDrawPrizeBase::LoadFromFile(CFileStream &file)
{
// Factory loads m_nType outside.
file.ReadUChar(m_nLevel);
file.ReadUChar(m_nSexNeed);
file.ReadBool(m_bAnnounce);
ASSERT(m_nType < ELuckDrawPrizeType_Max);
ASSERT(m_nLevel < ELuckDrawPrizeLevel_Max);
ASSERT(m_nSexNeed < ESexType_Max);
}
示例10:
CMesh::TMeshContainer &CGlobalMshLoader::LoadMeshFromFile(const nstring &file)
{
CFileStream sfile;
sfile.Open(file);
LoadMeshFromStream(&sfile);
sfile.Close();
return gMeshBuffer;
}
示例11: strFileName
void CMedalCfgMgr::LoadConfigFromFile()
{
std::string strFileName( g_sPath );
strFileName.append( MEDAL_FILE_NAME );
CFileStream file;
file.open( strFileName.c_str(), "rb" );
LoadMedalConfigFromFile( file );
LoadProgressConfigFromFile( file );
file.close();
}
示例12: CFileStream
bool CDocument::SaveToFile(const std::wstring& wsPath)
{
CFileStream* pStream = new CFileStream();
if (!pStream || !pStream->OpenFile(wsPath, true))
return false;
if (m_pJbig2)
m_pJbig2->FlushStreams();
SaveToStream((CStream*)pStream);
delete pStream;
return true;
}
示例13: Save
bool CThemeParcloseConfig::Save(CFileStream & file)
{
file.WriteUInt(m_nThemeID);
CParcloseConfig::Save(file);
return true;
}
示例14: LoadSource
//////////////////////////////////////////////////////////////////////
// CShader
//////////////////////////////////////////////////////////////////////
bool CShader::LoadSource(const string& filename, const string& prefix)
{
if(filename.empty())
return true;
CFileStream file;
if(!file.Open("special://xbmc/system/shaders/" + filename))
{
CLog::Log(LOGERROR, "CYUVShaderGLSL::CYUVShaderGLSL - failed to open file %s", filename.c_str());
return false;
}
getline(file, m_source, '\0');
m_source.insert(0, prefix);
return true;
}
示例15: AppendSource
bool CShader::AppendSource(const string& filename)
{
if(filename.empty())
return true;
CFileStream file;
string temp;
if(!file.Open("special://xbmc/system/shaders/" + filename))
{
CLog::Log(LOGERROR, "CShader::AppendSource - failed to open file %s", filename.c_str());
return false;
}
getline(file, temp, '\0');
m_source.append(temp);
return true;
}