本文整理汇总了C++中CFileStream::Open方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileStream::Open方法的具体用法?C++ CFileStream::Open怎么用?C++ CFileStream::Open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileStream
的用法示例。
在下文中一共展示了CFileStream::Open方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnSave
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: 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;
}
示例3: 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;
}
示例4: SaveTo
void CBaseMemoryStream::SaveTo( const char* lpszFileName )
{
CFileStream* fs = new CFileStream();
#ifdef SCUT_UPHONE
if (fs->Open(lpszFileName, PO_CREAT | PO_RDWR | PO_BINARY, PS_IREAD | PS_IWRITE) == 0)
{
this->SaveTo(fs);
delete fs;
}
#else
if (fs->Open(lpszFileName, 0, 0, "wb+") == 0)
{
this->SaveTo(fs);
delete fs;
}
#endif
}
示例5: LoadFrom
void CMemoryStream::LoadFrom( const char* lpszFileName )
{
CFileStream* pStream = new CFileStream();
#ifdef SCUT_UPHONE
if (pStream->Open(lpszFileName, PO_CREAT | PO_RDWR | PO_BINARY, PS_IREAD | PS_IWRITE) == 0)
{
this->LoadFrom(pStream);
delete pStream;
}
#else
if (pStream->Open(lpszFileName, 0, 0, "rb") == 0)
{
this->LoadFrom(pStream);
delete pStream;
}
#endif
}
示例6: SaveMeshToFile
void CGlobalMshLoader::SaveMeshToFile(const CMesh::TMeshContainer &mesh, const nstring &file)
{
CFileStream sfile;
sfile.Open(file, true, false);
SaveMeshToStream(mesh, &sfile);
sfile.Close();
}
示例7: 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);
}
示例8:
CMesh::TMeshContainer &CGlobalMshLoader::LoadMeshFromFile(const nstring &file)
{
CFileStream sfile;
sfile.Open(file);
LoadMeshFromStream(&sfile);
sfile.Close();
return gMeshBuffer;
}
示例9: 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;
}
示例10: Load
bool CPlayList::Load(const std::string& strFileName)
{
Clear();
m_strBasePath = URIUtils::GetDirectory(strFileName);
CFileStream file;
if (!file.Open(strFileName))
return false;
if (file.GetLength() > 1024*1024)
{
CLog::Log(LOGWARNING, "%s - File is larger than 1 MB, most likely not a playlist", __FUNCTION__);
return false;
}
return LoadData(file);
}
示例11: 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;
}
示例12: playlist
TiXmlElement *CSmartPlaylist::OpenAndReadName(const CStdString &path)
{
CFileStream file;
if (!file.Open(path))
{
CLog::Log(LOGERROR, "Error loading Smart playlist %s (failed to read file)", path.c_str());
return NULL;
}
m_xmlDoc.Clear();
file >> m_xmlDoc;
if (m_xmlDoc.Error())
{
CLog::Log(LOGERROR, "Error loading Smart playlist (failed to parse xml: %s)", m_xmlDoc.ErrorDesc());
return NULL;
}
TiXmlElement *root = m_xmlDoc.RootElement();
if (!root || strcmpi(root->Value(),"smartplaylist") != 0)
{
CLog::Log(LOGERROR, "Error loading Smart playlist %s", path.c_str());
return NULL;
}
// load the playlist type
const char* type = root->Attribute("type");
if (type)
m_playlistType = type;
// backward compatibility:
if (m_playlistType == "music")
m_playlistType = "songs";
if (m_playlistType == "video")
m_playlistType = "musicvideos";
// load the playlist name
TiXmlHandle name = ((TiXmlHandle)root->FirstChild("name")).FirstChild();
if (name.Node())
m_playlistName = name.Node()->Value();
else
{
m_playlistName = CUtil::GetTitleFromPath(path);
if (URIUtils::GetExtension(m_playlistName) == ".xsp")
URIUtils::RemoveExtension(m_playlistName);
}
return root;
}
示例13: AppendSource
bool CShader::AppendSource(const std::string& filename)
{
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::AppendSource - failed to open file %s", filename.c_str());
return false;
}
getline(file, temp, '\0');
m_source.append(temp);
return true;
}
示例14: OnPackFileStream
void CNumberFileStreamDlg::OnPackFileStream()
{
char szPath[MAX_PATH];
CFileStream fileStream;
GetCurrentDirectory(sizeof(szPath),szPath);
strcat(szPath,"\\moesky.dat");
if(fileStream.Open(szPath))
{
fileStream.LoadFromStream();
memory_tree_t * tree = fileStream.GetFile("/exit_nomal.bmp");
if(tree)
{
FILE* f = fopen("c:\\test.bmp","wb+");
fwrite((void*)tree->dataOffset,tree->dataSize,1,f);
fclose(f);
MessageBox(fileStream.GetName(tree->nStringIdx));
}
}
}
示例15: readName
TiXmlElement *CSmartPlaylist::OpenAndReadName(const CStdString &path)
{
CFileStream file;
if (!file.Open(path))
{
CLog::Log(LOGERROR, "Error loading Smart playlist %s (failed to read file)", path.c_str());
return NULL;
}
m_xmlDoc.Clear();
file >> m_xmlDoc;
TiXmlElement *root = readName();
if (m_playlistName.empty())
{
m_playlistName = CUtil::GetTitleFromPath(path);
if (URIUtils::GetExtension(m_playlistName) == ".xsp")
URIUtils::RemoveExtension(m_playlistName);
}
return root;
}