int _tmain(int argc, _TCHAR* argv[]) { { std::string strTables; GetHtmlForTable(PhTranslation::Bengali, strTables); SaveToFile(strTables, "BengaliTable.html"); } { std::string strTables; GetHtmlForTable(PhTranslation::Gujarati, strTables); SaveToFile(strTables, "GujaratiTable.html"); } { std::string strTables; GetHtmlForTable(PhTranslation::Hindi, strTables); SaveToFile(strTables, "HindiTable.html"); } { std::string strTables; GetHtmlForTable(PhTranslation::Kannada, strTables); SaveToFile(strTables, "KannadaTable.html"); } { std::string strTables; GetHtmlForTable(PhTranslation::Malayalam, strTables); SaveToFile(strTables, "MalayalamTable.html"); } { std::string strTables; GetHtmlForTable(PhTranslation::Oriya, strTables); SaveToFile(strTables, "OriyaTable.html"); } { std::string strTables; GetHtmlForTable(PhTranslation::Punjabi, strTables); SaveToFile(strTables, "PunjabiTable.html"); } { std::string strTables; GetHtmlForTable(PhTranslation::Sanskrit, strTables); SaveToFile(strTables, "SanskritTable.html"); } { std::string strTables; GetHtmlForTable(PhTranslation::Tamil, strTables); SaveToFile(strTables, "TamilTable.html"); } { std::string strTables; GetHtmlForTable(PhTranslation::Telugu, strTables); SaveToFile(strTables, "TeluguTable.html"); } return 0; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); Dialog w; w.show(); tv *TV = new tv(); QObject::connect(&w, SIGNAL(AddItem(QString,QString,QString,QString)),TV, SLOT(AddItem(QString,QString,QString,QString))); QObject::connect(TV, SIGNAL(setTable(QDVector)),&w,SLOT(setTable(QDVector))); QObject::connect(&w, SIGNAL(DeleteItem(int)),TV,SLOT(DeleteItem(int))); QObject::connect(&w, SIGNAL(EditItem(int,QString,QString,QString,QString)),TV,SLOT(EditItem(int,QString,QString,QString,QString))); QObject::connect(&w, SIGNAL(SaveToFile()), TV, SLOT(SaveToFile())); QObject::connect(&w, SIGNAL(OpenFromFile()), TV, SLOT(OpenFromFile())); return a.exec(); }
void SaveToFile(MyTree<T> *root, ofstream& ost) { MyTree<T>* tmp = root; if (tmp != nullptr) { ost << tmp->data << ' '; if (tmp->left != nullptr) { SaveToFile(tmp->left, ost); } if (tmp->right != nullptr) { SaveToFile(tmp->right, ost); } } }
int DumpAllFiles(const char *pin) { uint8 list[2 * 128]; uint16 sw1sw2; int rc, i; rc = SC_Open(pin, 0); if (rc < 0) return rc; /* - SmartCard-HSM: ENUMERATE OBJECTS */ rc = SC_ProcessAPDU( 0, 0x00,0x58,0x00,0x00, NULL, 0, list, sizeof(list), &sw1sw2); if (rc < 0) { SC_Close(); return rc; } /* save dir and all files */ printf("write 'dir.hsm'\n"); SaveToFile("dir.hsm", list, rc); for (i = 0; i < rc; i += 2) { uint8 buf[8192], *p; char name[10]; int rc, off; uint16 fid = list[i] << 8 | list[i + 1]; if (list[i] == 0xcc) /* never readable */ continue; for (p = buf, off = 0; off < sizeof(buf); p += rc) { int l = sizeof(buf) - off; if (l > MAX_OUT_IN) l = MAX_OUT_IN; rc = SC_ReadFile(fid, off, p, l); if (rc < 0) break; off += rc; if (rc < l) break; } if (rc >= 0) { sprintf(name, "%04X.asn", fid); printf("write '%s'\n", name); SaveToFile(name, buf, off); } } SC_Close(); return 0; }
//--------------------------------------------------------------------------- void __fastcall TOrdEntryForm::Save1Click(TObject *Sender) { if (CurFile == "NONAME") SaveAs1Click(Sender); else SaveToFile(CurFile); }
bool SaveToFile(const std::string& data, const std::wstring& path, bool take_backup) { if (data.empty()) return false; return SaveToFile((LPCVOID)&data.front(), data.size(), path, take_backup); }
BOOL CSSD::DlgSendForKey(CString email) { CWnd* pParentWnd = AfxGetMainWnd(); CDlgSend dlg(pParentWnd); dlg.m_User = m_ssd; if (dlg.DoModal() == IDOK) { m_ssd = dlg.m_User; TCHAR lpBuffer[MAX_PATH]; //GetTempPath(MAX_PATH, lpBuffer); GetModuleFileName(NULL, lpBuffer, MAX_PATH); CString szFileName = lpBuffer; szFileName = szFileName.Left(szFileName.ReverseFind('\\') + 1); szFileName += m_ssd.m_szName; szFileName += _T(".forkey"); if (!SaveToFile(szFileName)) return FALSE; return SendMail(email, szFileName); DeleteFile(szFileName); return TRUE; } return FALSE; }
LIB_EXPORT rc_t CC WriteNamelistToFileByName( const VNamelist * namelist, const char * filename, const char * delim ) { rc_t rc; if ( namelist == NULL || filename == NULL || delim == NULL ) rc = RC( rcFS, rcFile, rcValidating, rcParam, rcNull ); else { KDirectory * dir; rc = KDirectoryNativeDir ( &dir ); if ( rc == 0 ) { KFile * f; rc = KDirectoryCreateFile ( dir, &f, true, 0664, kcmCreate, filename ); if ( rc == 0 ) { if ( rc == 0 ) rc = SaveToFile( f, namelist, delim ); KFileRelease ( f ); } KDirectoryRelease ( dir ); } } return rc; }
bool CMailViewTpl::View( bool bEditor, bool bLock ) { FarFileName TempFile = FarFileName::MakeTemp( "mvt" ); CreateDirectory( TempFile.GetBuffer() ); TempFile.ReleaseBuffer(); TempFile.AddEndSlash(); TempFile.SetName( FarFileName::MakeTemp( "mvt" ) ); TempFile.SetExt( ".msg" ); if ( SaveToFile( TempFile ) == false ) return false; FarString Subj = m_origMsg->GetSubject(); if ( Subj.IsEmpty() ) Subj = "<none>"; SetFileAttributes( TempFile, GetFileAttributes( TempFile )|(bLock?FILE_ATTRIBUTE_READONLY:0) ); if ( bEditor ) Far::Editor( TempFile, Subj, 0, 0, -1, -1, 0, 1, EF_DELETEONCLOSE|EF_DISABLEHISTORY|EF_ENABLE_F6|EF_NONMODAL ); else Far::Viewer( TempFile, Subj, 0, 0, -1, -1, VF_DELETEONCLOSE|VF_DISABLEHISTORY|VF_ENABLE_F6|VF_NONMODAL ); return true; }
//--------------------------------------------------------------------------- void __fastcall TEditorForm::EditorActionsExecute(TBasicAction *Action, bool &Handled) { Handled = true; if (Action == SaveAction) { assert(!FFileName.IsEmpty()); SaveToFile(); if (FOnFileChanged) { FOnFileChanged(this); } EditorMemo->Modified = false; UpdateControls(); } else if (Action == PreferencesAction) { DoPreferencesDialog(pmEditor); } else if (Action == ReloadAction) { Reload(); } else if (Action == FindAction || Action == ReplaceAction) { StartFind(Action == FindAction); } else if (Action == FindNextAction) { if (!FLastFindDialog) { FLastFindDialog = FFindDialog; } Find(); } else if (Action == GoToLineAction) { GoToLine(); } else if (Action == EditRedo) { EditorMemo->Redo(); } else if (Action == HelpAction) { FormHelp(this); } else if (Action == DefaultEncodingAction) { ChangeEncoding(TEncoding::Default); } else if (Action == UTF8EncodingAction) { ChangeEncoding(TEncoding::UTF8); } else { Handled = false; } }
void CComputerGrid::OnTimer(UINT nIDEvent) { switch (nIDEvent) { case TimeIdOfUpdateTime : { UpdateAllComputersUseTime(); //上班且在线用户不为零 if (theApp.GetCurCashier()->IsOnDuty()) { CComputerList::CStatInfo StatInfo; m_lpComputerList->GetStatInfo(StatInfo); if (StatInfo.GetOnline() > 0) { SaveToFile(); } } break; } } CIBAGrid::OnTimer(nIDEvent); }
//--------------------------------------------------------------------------- void __fastcall TOrdEntryForm::SaveAs1Click(TObject *Sender) { if (SaveDialog1->Execute()) { SaveToFile(SaveDialog1->FileName); UpdateFileName(SaveDialog1->FileName); } }
bool CMakeBlkFile::Save() { bool bRet = GetBasePt(); if (!bRet) { return false; } bRet = SelectEnt(); if (!bRet) { return false; } bRet = SaveToFile(); if (!bRet) { return bRet; } if (!m_baseInfo.GetFNumber().IsEmpty()) { CDataCell pCell; pCell = m_blkFile.GetDataCellByDB(m_baseInfo); m_blkFile.SetData(pCell); CString strCsvFile; CString strTmp = m_strFileName.Left(m_strFileName.GetLength() - 4); strCsvFile = strTmp + _T(".txt"); m_blkFile.SetFileName(strCsvFile); m_blkFile.Write(); } return bRet; }
void CComponentProxyManager::SaveCurFile() { if (m_uCurrViewFileId != 0xFFFFFFFF) { const std::map<uint32_t, CComponentProxy*>& componentsInScene = GetComponentsInCurScene(); std::map<uint32_t, std::vector<CComponentProxy*>> guidGroup; for (std::map<uint32_t, CComponentProxy*>::const_iterator iter = componentsInScene.begin(); iter != componentsInScene.end(); ++iter) { uint32_t uGuid = iter->second->GetGuid(); if (guidGroup.find(uGuid) == guidGroup.end()) { guidGroup[uGuid] = std::vector<CComponentProxy*>(); } guidGroup[uGuid].push_back(iter->second); } const TString& strComponentFileName = m_pProject->GetComponentFileName(m_uCurrViewFileId); BEATS_ASSERT(!strComponentFileName.empty()); SaveToFile(strComponentFileName.c_str(), guidGroup); // Recycle all id, because we will reload it in CComponentProject::ReloadFile for (auto iter = componentsInScene.begin(); iter != componentsInScene.end(); ++iter) { m_pIdManager->RecycleId(iter->first); } // We just reload the whole file to keep the id manager is working in the right way. m_pProject->ReloadFile(m_uCurrViewFileId); } }
bool SysConf::Save() { if (!m_IsValid) return false; return SaveToFile(m_Filename); }
int main() { MyTree<int>* root = CreateEmptyTree<int>(); LoadFromFile(root, "C:\\input.txt"); Square(root); SaveToFile(root, "C:\\out.txt"); DeleteTree(root); }
bool LightmapGenerator::Generate() { Init(); for (size_t i = 0; i < bsp.ConvexPolygons.size(); i++) { // The progress function returning false // indicates that the generation needs to stop. if (pProgressFn && !pProgressFn((float)i / (float)bsp.ConvexPolygons.size())) return false; int lightmapsize{}; if (!ProcessConvexPolygon(&bsp.ConvexPolygons[i], i, lightmapsize)) { MLog("LightmapGenerator::Generate -- ProcessConvexPolygon failed for polygon index %d\n", i); return false; } InsertLightmap(lightmapsize, i); } if (!SaveToFile()) { MLog("LightmapGenerator::Generate -- SaveToFile failed\n"); return false; } return true; }
int CutTxtMain(TCHAR *file_name) { FileEx src_file(file_name); if (src_file.Open()) { DWORD rw = 0; LONGLONG ptr = 0; BYTE r_buff[BLOCK_SIZE] = {0}; STATISTIC statistic; while (rw = src_file.Read(r_buff, BLOCK_SIZE)) { AnalyzeBuffer(r_buff, rw, statistic); if (IsPartOfTextFile(statistic)) { SaveToFile(src_file, ptr); } src_file.GetPointer(&ptr); _tprintf(_T("LBA: %I64d\n"), ptr/BLOCK_SIZE); } return 0; } return -1; }
bool ClientOptions::Save() { if (m_LastFile.empty()) return false; else return SaveToFile(m_LastFile); }
void TIniFile::WriteString(const wxString &Section, const wxString &Ident, const wxString &Value) { int I; I = GetSectionIndex(Section); // Section exists if (I != -1) { ++I; while ((I < FFileBuffer->Count()) && !IsSection(FFileBuffer->Item(I)) && (GetName(FFileBuffer->Item(I)) != Ident)) ++I; // End of File or Ident doesn't exists in the Section if ((I >= FFileBuffer->Count()) || IsSection(FFileBuffer->Item(I))) { if (Ident != EmptyStr) FFileBuffer->Insert(I, Ident + IniSeparator + Value); } // Ident does exists in the section else if (Ident != EmptyStr) FFileBuffer->Item(I) = Ident + IniSeparator + Value; } // Section doesn't exists, so add new [Section] with Ident=Value else { FFileBuffer->Add(EmptyStr); FFileBuffer->Add(IniBrackets[0] + Section + IniBrackets[1]); if (Ident != EmptyStr) FFileBuffer->Add(Ident + IniSeparator + Value); } SaveToFile(); }
/** 写出置顶字文件 */ void SaveTopZiData() { TCHAR name[MAX_PATH]; FILE *fw; int i, j; HZ top_zi[MAX_TOPZI + 1]; TCHAR head_msg[500] = {0xFEFF, 0}; static TCHAR *topzi_header_msg = TEXT("#固顶字定义文件\n") TEXT("#格式:\n") TEXT("# 拼音=固顶字(组)\n") TEXT("# 一行内容可以定义最多8个固顶字,第8个之后的,将被忽略\n") TEXT("#如:\n") TEXT("# wo=我\n") TEXT("# d=的地得\n") TEXT("# de=的地得\n\n") TEXT("#在输入时,可以直接按 ctrl+shift+数字 来进行任意字的快速固顶。\n") TEXT("#最后固顶的排在第一位,其它顺序排列。\n"); if (!share_segment) return; _tcscat_s(head_msg, _SizeOf(head_msg), topzi_header_msg); //获得用户topzi文件名称 GetFileFullName(TYPE_USERAPP, TOPZI_FILE_NAME, name); if (!SaveToFile(name, head_msg, (int)_tcslen(head_msg) * sizeof(TCHAR))) return; fw = _tfopen(name, TEXT("ab")); if (!fw) return; //对topzi数组进行排序 qsort(share_segment->topzi_table, share_segment->topzi_table_items, sizeof(share_segment->topzi_table[0]), CompareTopZiItem); for (i = 0; i < share_segment->syllable_map_items; i++) { SYLLABLE s; if (share_segment->syllable_map[i].fuzzy_flag) //模糊的音不输出 continue; //if (share_segment->syllable_map[i].correct_flag) // continue; s.con = share_segment->syllable_map[i].con; s.vow = share_segment->syllable_map[i].vow; s.tone = TONE_0; GetTopZi(s, top_zi); _ftprintf(fw, TEXT("%s="), share_segment->syllable_map[i].pin_yin); for (j = 0; top_zi[j] && j < MAX_TOPZI; j++) _ftprintf(fw, TEXT("%c"), top_zi[j]); _ftprintf(fw, TEXT("\n")); } fclose(fw); }
int main() { MyTree<int>* root = CreateEmptyTree<int>(); LoadFromFile(root, "C:\\input.txt"); Square(root); ofstream ost("C:\\out.txt"); // открытие потока для записи в файл SaveToFile(root, ost); DeleteTree(root); }
std::string ribi::cmap::ToDot(const ConceptMap& g) noexcept { const std::string temp_filename{FileIo().GetTempFileName(".dot")}; SaveToFile(g, temp_filename); std::stringstream s; s << FileIo().FileToStr(temp_filename); return s.str(); }
void chunk::Unload(){ if (this == nullptr) return; #ifndef DEBUG_NO_FILEIO SaveToFile(); #endif destroylists(); destroy(); }
void chunk::Unload() { unloadedChunksCount++; #ifndef NEWORLD_DEBUG_NO_FILEIO SaveToFile(); #endif destroyRender(); destroy(); }
ClientOptions::ClientOptions(const std::string &filename, const std::string &type) : m_Type(type) { //m_PlayerVariables.resize(s_MaxLocalPlayers); if (!LoadFromFile(filename)) SaveToFile(filename); }
/** 保存汉字Cache数据 * 返回: * 成功:1,失败:0 */ int SaveZiCacheData(const TCHAR *zi_cache_name) { if (share_segment->zi_cache_modified) { share_segment->zi_cache_modified = 0; return SaveToFile(zi_cache_name, (char*)&share_segment->hz_cache, sizeof(share_segment->hz_cache)) != -1; } return 1; }
bool PolarGlue::SaveToFile(const PolarInfo &polar, const TCHAR* path) { TextWriter writer(path); if (!writer.IsOpen()) return false; return SaveToFile(polar, writer); }
bool SolveSpaceUI::Autosave() { SetAutosaveTimerFor(autosaveInterval); if(!saveFile.empty() && unsaved) return SaveToFile(saveFile + AUTOSAVE_SUFFIX); return false; }
//--------------------------------------------------------------------------- void __fastcall TFrmMain::btSaveClick(TObject *Sender) { //CurrentOpenFile; if(OpenOk){ SaveToFile(CurrentOpenFile.c_str()); }else{ ShowMessage("文件未打开完成!"); } }