本文整理汇总了C++中CFileWriter::Write方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileWriter::Write方法的具体用法?C++ CFileWriter::Write怎么用?C++ CFileWriter::Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileWriter
的用法示例。
在下文中一共展示了CFileWriter::Write方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//================================================================================================================
//================================================================================================================
CreateGameDirectory::CreateGameDirectory(GameDirectory2D* gd, GameType2D gameType)
{
_mkdir(gd->GAME_FOLDER.c_str());
_mkdir(gd->m_required_textures.c_str());
_mkdir(gd->m_sprites_path.c_str());
_mkdir(gd->m_menu_sprites_path.c_str());
_mkdir(gd->m_hud_path.c_str());
_mkdir(gd->m_tiles_path.c_str());
_mkdir(gd->m_scripts_path.c_str());
_mkdir(gd->m_music_path.c_str());
_mkdir(gd->m_animation_profiles_path.c_str());
_mkdir(gd->m_animation_profile_sprites_path.c_str());
_mkdir(gd->m_animation_profile_tiles_path.c_str());
_mkdir(gd->m_xml_path.c_str());
_mkdir(gd->m_xml_maps_path.c_str());
_mkdir(gd->m_xml_sprites_path.c_str());
//_mkdir(gd->m_xml_menu_path.c_str());
//_mkdir(gd->m_xml_hud_path.c_str());
_mkdir(gd->m_xml_worlds_path.c_str());
if (gameType == TOPDOWN)
{
CFileWriter fileWriter;
fileWriter.Open(gd->m_game_ini_path);
fileWriter.Write("[GAME]\n");
fileWriter.Write("\n");
fileWriter.Write(";Game can either be Topdown or Platformer, 3D for 3D game\n");
fileWriter.Write("GameType=Topdown\n");
fileWriter.Close();
}
else if (gameType == PLATFORMER)
{
CFileWriter fileWriter;
fileWriter.Open(gd->m_game_ini_path);
fileWriter.Write("[GAME]\n");
fileWriter.Write("\n");
fileWriter.Write(";Game can either be Topdown or Platformer, 3D for 3D game\n");
fileWriter.Write("GameType=Platformer\n");
fileWriter.Close();
}
CFileWriter fileMainMenuWriter;
fileMainMenuWriter.Open(gd->m_xml_main_menu_path);
fileMainMenuWriter.Close();
CFileWriter fileInGameMenuWriter;
fileInGameMenuWriter.Open(gd->m_xml_ingame_menu_path);
fileInGameMenuWriter.Close();
CFileWriter fileHUDWriter;
fileHUDWriter.Open(gd->m_xml_hud_path);
fileHUDWriter.Close();
CFileWriter fileInventoryWriter;
fileInventoryWriter.Open(gd->m_xml_inventory_path);
fileInventoryWriter.Close();
CopyFolder("RequiredTextures", gd->m_required_textures);
CopyFolder("RequiredScripts", gd->m_scripts_path);
}
示例2:
//---------------------------------------------------------------------------
// @function:
// CIOUtils::Dump
//
// @doc:
// Dump given string to output file
//
//---------------------------------------------------------------------------
void
CIOUtils::Dump
(
CHAR *file_name,
CHAR *sz
)
{
CAutoSuspendAbort asa;
const ULONG ulWrPerms = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
GPOS_TRY
{
CFileWriter fw;
fw.Open(file_name, ulWrPerms);
const BYTE *pb = reinterpret_cast<const BYTE*>(sz);
ULONG_PTR ulpLength = (ULONG_PTR) clib::Strlen(sz);
fw.Write(pb, ulpLength);
fw.Close();
}
GPOS_CATCH_EX(ex)
{
// ignore exceptions during dumping
GPOS_RESET_EX;
}
GPOS_CATCH_END;
// reset time slice
#ifdef GPOS_DEBUG
CWorker::Self()->ResetTimeSlice();
#endif // GPOS_DEBUG
}
示例3: textToString
Datum
DumpQueryToFile(PG_FUNCTION_ARGS)
{
char *szSql = textToString(PG_GETARG_TEXT_P(0));
char *szFilename = textToString(PG_GETARG_TEXT_P(1));
size_t iQueryStringLen = -1;
char *pcQuery = getQueryBinary(szSql, &iQueryStringLen);
CFileWriter fw;
fw.Open(szFilename, S_IRUSR | S_IWUSR);
fw.Write(reinterpret_cast<const BYTE*>(&iQueryStringLen), sizeof(iQueryStringLen));
fw.Write(reinterpret_cast<const BYTE*>(pcQuery), iQueryStringLen);
fw.Close();
PG_RETURN_UINT32( (ULONG) iQueryStringLen);
}
示例4: getPlannedStmtBinary
Datum
DumpPlanToFile(PG_FUNCTION_ARGS)
{
char *szSql = text_to_cstring(PG_GETARG_TEXT_P(0));
char *szFilename = text_to_cstring(PG_GETARG_TEXT_P(1));
size_t iBinaryLen = -1;
char *pcBinary = getPlannedStmtBinary(szSql, &iBinaryLen);
CFileWriter fw;
fw.Open(szFilename, S_IRUSR | S_IWUSR);
fw.Write(reinterpret_cast<const BYTE*>(&iBinaryLen), sizeof(iBinaryLen));
fw.Write(reinterpret_cast<const BYTE*>(pcBinary), iBinaryLen);
fw.Close();
PG_RETURN_UINT32((ULONG) iBinaryLen);
}
示例5:
//================================================================================================================
CreateGameDirectory::CreateGameDirectory(GameDirectory3D* gd)
{
_mkdir(gd->GAME_FOLDER.c_str());
_mkdir(gd->m_required_textures.c_str());
_mkdir(gd->m_menu_sprites_path.c_str());
_mkdir(gd->m_hud_path.c_str());
_mkdir(gd->m_scripts_path.c_str());
_mkdir(gd->m_music_path.c_str());
_mkdir(gd->m_materials_path.c_str());
_mkdir(gd->m_heightmaps_path.c_str());
_mkdir(gd->m_template_poly_path.c_str());
_mkdir(gd->m_models_path.c_str());
_mkdir(gd->m_textures_path.c_str());
_mkdir(gd->m_xml_path.c_str());
//_mkdir(gd->m_xml_menu_path.c_str());
//_mkdir(gd->m_xml_hud_path.c_str());
_mkdir(gd->m_xml_maps_path.c_str());
CFileWriter fileWriter;
fileWriter.Open(gd->m_game_ini_path);
fileWriter.Write("[GAME]\n");
fileWriter.Write("\n");
fileWriter.Write(";Game can either be Topdown or Platformer, 3D for 3D game\n");
fileWriter.Write("GameType=3D\n");
fileWriter.Close();
CFileWriter fileMainMenuWriter;
fileMainMenuWriter.Open(gd->m_xml_main_menu_path);
fileMainMenuWriter.Close();
CFileWriter fileInGameMenuWriter;
fileInGameMenuWriter.Open(gd->m_xml_ingame_menu_path);
fileInGameMenuWriter.Close();
CFileWriter fileHUDWriter;
fileHUDWriter.Open(gd->m_xml_hud_path);
fileHUDWriter.Close();
CopyFolder("RequiredTextures", gd->m_required_textures);
CopyFolder("RequiredScripts", gd->m_scripts_path);
CopyFolder("TemplatePolys", gd->m_template_poly_path);
}
示例6: INFO_PRINTF1
// The implementation for this is not working correctly! Check this
void CFile0Step::TestWriteL()
{
INFO_PRINTF1(_L("Checking that CFileWriter::Write(const TDesC8&) writes a String correctly to C:\\logs\\log.txt"));
// Create new CFileWriter instance
CFileWriter* fileWriter = CFileWriter::NewL();
_LIT8(KTxt, "Test");
INFO_PRINTF1(_L("Writing 'Test' to the log using CFileWriter::Write()"));
ASSERT_EQUALS(KErrNone, fileWriter->Write(KTxt));
delete fileWriter;
}
示例7: parseSQL
static int translateQueryToFile
(
char *szSqlText,
char *szFilename
)
{
Query *pquery = parseSQL(szSqlText);
Assert(pquery);
char *szXmlString = COptTasks::SzDXL(pquery);
int iLen = (int) gpos::clib::UlStrLen(szXmlString);
CFileWriter fw;
fw.Open(szFilename, S_IRUSR | S_IWUSR);
fw.Write(reinterpret_cast<const BYTE*>(szXmlString), iLen + 1);
fw.Close();
return iLen;
}