本文整理汇总了C++中TStringList::SaveToFile方法的典型用法代码示例。如果您正苦于以下问题:C++ TStringList::SaveToFile方法的具体用法?C++ TStringList::SaveToFile怎么用?C++ TStringList::SaveToFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TStringList
的用法示例。
在下文中一共展示了TStringList::SaveToFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FormClose
void __fastcall TfMain::FormClose(TObject *Sender, TCloseAction &Action)
{
TFile f;
TStringList* sl = new(TStringList);
for(int i = 0; i < lvLib->Items->Count; i++)
sl->Add(lvLib->Items->Item[i]->SubItems->Strings[0] + '=' +
lvLib->Items->Item[i]->SubItems->Strings[1] + '/' +
lvLib->Items->Item[i]->SubItems->Strings[2]);
sl->SaveToFile(ExtractFileDir(Application->ExeName) + "\\Library.lb");
sl->Clear();
sl->Add("Login=" + leLogin->Text);
if(cbRememberPass->Checked)
sl->Add("Pass=" + lePass->Text);
else
sl->Add("Pass=");
if(cbRememberPass->Checked)
sl->Add("RememberPass=1");
else
sl->Add("RememberPass=0");
sl->Add("Server=" + leServer->Text);
sl->SaveToFile(ExtractFileDir(Application->ExeName) + "\\Settings.ini");
sl->~TStringList();
}
示例2: SaveConfig
//---------------------------------------------------------------------------
void TRsyncConfigAdapter::SaveConfig(){
TStringList* lines = new TStringList();
TModuleHolder* currentModule = GetModuleHolder(GLOBAL_MODULE);
for(int i = 0; i < currentModule->nvp->Count; i++){
lines->Add(currentModule->nvp->Strings[i]);
}
//Now get remaining modules
for(int j = 0; j < modules->Count; j++){
currentModule = (TModuleHolder*)modules->Items[j];
if(currentModule->moduleName == GLOBAL_MODULE){
continue;
}
lines->Add("[" + currentModule->moduleName + "]");
for(int i = 0; i < currentModule->nvp->Count; i++){
lines->Add(currentModule->nvp->Strings[i]);
}
}
lines->SaveToFile(CONFIG_FILE);
delete lines;
}
示例3: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
seakgOutput *pOutput = 0;
TStringList *list = new TStringList();
if (argc == 5) {
pOutput = new seakgOutput_list(list);
} else if (argc == 4) {
pOutput = new seakgOutput_std();
} else {
std::wcout << "usage: input_folder project_name prefix_id output_file\n";
std::wcout << "or usage: input_folder project_name prefix_id\n";
return -1;
}
//
// output->Add("<add>");
pOutput->addline("<add>");
rootPath = UnicodeString(argv[1]); // L"C:\\Projects\\ACTApro.git";
projectName = UnicodeString(argv[2]); // L"ACTApro 2.0 (rev. )";
prefixforid = UnicodeString(argv[3]);
g_nInc = 0;
SearchAndScan(pOutput, rootPath);
// output->Add("</add>");
pOutput->addline("</add>");
if (argc == 5) {
UnicodeString outputFile = UnicodeString(argv[4]);
list->SaveToFile(outputFile);
}
return 0;
}
示例4: SaveFile
void HTMLDocument::SaveFile(const String &filename)
{ TStringList *sl = new TStringList;
sl->Text = html;
sl->SaveToFile(filename);
delete sl;
setchanged(false);
}
示例5: btn_item_saveClick
void __fastcall TfrmMain::btn_item_saveClick(TObject *Sender)
{
TStringList *list = new TStringList();
for (int i = 0; i < list_filter->Count; i++)
{
list->Add((int)list_filter->Items->Objects[i]);
}
list->SaveToFile(String(LoginerPath) +"\\Data\\"+ GameAccount + "\\Items.dat");
delete list;
}
示例6: ExportCFileClick
//---------------------------------------------------------------------------
void __fastcall TFormMain::ExportCFileClick(TObject *Sender)
{
if (ExportDialog->Execute())
{
TStringList* SL = new TStringList;
__try
{
ChangeFileExt(ExtractFileName(ExportDialog->FileName), "");
SL->Add(Format("YETI_ROM rom_map_t %s = {", ARRAYOFCONST((
ChangeFileExt(ExtractFileName(ExportDialog->FileName), "")))));
SL->Add(Format("\"%s\",\"%s\",\"%s\",{", ARRAYOFCONST((
"Test Map",
"Derek J. Evans",
"Welcome to Yeti3D"))));
for (int y = 0; y < YETI_MAP_HEIGHT; y++)
{
SL->Add("{");
for (int x = 0; x < YETI_MAP_WIDTH; x++)
{
cell_t* cell = &yeti->cells[y][x];
SL->Add(Format("{%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d},", ARRAYOFCONST((
cell->swi,
cell->ent,
cell->top,
cell->mid,
cell->bot,
cell->lit,
cell->wtx,
cell->ttx,
cell->mtx,
cell->btx,
0, // Reserved 1
0 // Reserved 2
))));
}
String S = SL->Strings[SL->Count - 1];
SL->Strings[SL->Count - 1] = S.SubString(1, S.Length() - 1);
SL->Add("},");
}
String S = SL->Strings[SL->Count - 1];
SL->Strings[SL->Count - 1] = S.SubString(1, S.Length() - 1);
SL->Add("}};");
SL->SaveToFile(ExportDialog->FileName);
}
__finally
{
SL->Free();
}
}
示例7: TStringList
//---------------------------------------------------------------------------
void __fastcall TFormGrepStringsDialog::SaveToFile1Click(TObject *Sender)
{
// Salvar los renglones seleccionados a un archivo.
TStringList *List = new TStringList();
if (List)
{
CreateStringListFormSelectRows(List, defALL);
if (SaveDialog->Execute())
List->SaveToFile(SaveDialog->FileName);
delete List;
}
}
示例8:
void __fastcall TMainForm::N2Click(TObject *Sender) {
TStringList *savetable = new TStringList;
if (Save->Execute()) {
for (int i = 0; i < Grid1->RowCount; i++) {
savetable->Add(Grid1->Rows[i]->DelimitedText);
}
savetable->SaveToFile(Save->FileName + ".tx1");
Console->Lines->Add("Сохранен файл " + Save->FileName);
delete savetable;
}
}
示例9: TStringList
void __fastcall TForm1::FileSaveAs1Accept(TObject *Sender)
{
String a = FileSaveAs1->Dialog->FileName;
if (a!=""){
// Speichern
if (ExtractFileExt(a).UpperCase()!=".AD")a=a.SubString(1,a.Length()-ExtractFileExt(a).Length())+".ad";
TStringList *List = new TStringList();
List->Add(IntToStr(Max));
List->Add(Edit1->Text);
for (int i=0;i<Max;i++){
List->Add(ListBox1->Items->Strings[i]);
for (int b=0;b<66;b++){
List->Add(IntToStr(Data[i][b]));
}
}
List->SaveToFile(a);
}
}
示例10:
Debug::~Debug()
{
if(ntimes==0) return;
if(!debug_on_exit) return;
TStringList *L = new TStringList;
double elapsed = 1000.0*((double)accumulated_counter.LowPart)/((double)FrequencyCounter.LowPart);
double average_elapsed = elapsed / (double) ntimes;
L->Add("Number of times called:"+AnsiString(ntimes));
L->Add("Elapsed time msec:"+AnsiString(elapsed));
L->Add("Average elapsed time msec:"+AnsiString(average_elapsed));
L->SaveToFile("c:\\debug.txt");
delete L;
}
示例11: Write
/*=============================================================================
*NAME :TYSIniFile::Write
:
*MODULE :YSIniFiles.cpp
:
*FUNCTION :書き込み処理関数です
:
*PROCESS :・Iniファイル書き込み処理です。
:
*RETURN : true = 正常終了
:false = エラー終了
:
*PROGRAMMED :Y.Sasai
*HISTORY :
*ID -- DATE ------- NOTE ------------------------------------------------------
*00 03.02.10 Y.Sasai Ver.0.90 初期作成
*/
bool TYSIniFile::Write( void )
{
TStringList slist; // 2003.02.10 Y.Sasai Ver.0.90 文字列リストクラス
int tempi; // 2003.02.10 Y.Sasai Ver.0.90 作業用変数
if ( FileName == "" ) { // 2003.02.10 Y.Sasai Ver.0.90 ファイル名未設定なら…
return ( false ); // 2003.02.10 Y.Sasai Ver.0.90 おわりだ
}
for ( tempi = 0; tempi < Count; tempi++ ) {
WriteSub( &slist, Items[tempi] ); // 2003.02.10 Y.Sasai Ver.0.90 書き込み処理だ
if ( tempi < ( Count - 1 ) ) { // 2003.02.10 Y.Sasai Ver.0.90 最後でないなら…
slist.Add( "" ); // 2003.02.10 Y.Sasai Ver.0.90 空行追加だ
}
}
slist.SaveToFile( FileName ); // 2003.02.10 Y.Sasai Ver.0.90 ファイルに書き込み
return ( true );
}
示例12: downloadCalendar
//---------------------------------------------------------------------------
bool TCalendarForm::downloadCalendar(String calendarURL, String dest)
{
try
{
String cal = IdHTTP1->Get( calendarURL );
// and write it out
TStringList *sl = new TStringList();
sl->Text = cal;
sl->SaveToFile( dest );
delete sl;
return true;
}
catch ( Exception & e )
{
ShowMessage( "HTPP Get of " + calendarURL + " failed: " + e.Message );
}
return false;
}
示例13: SaveModuleValues
//---------------------------------------------------------------------------
void TfrmMainFormServer::SaveModuleValues(){
if(lstModules->ItemIndex < 1){
return;
}
AnsiString selectedModule = lstModules->Items->Strings[lstModules->ItemIndex];
adapter.SetParamValue(selectedModule, "path", GenericUtils::ConvertPathWindowsToCygwin(txtPath->Text));
adapter.SetParamValue(selectedModule, "comment", txtComment->Text);
adapter.SetParamValue(selectedModule, "read only", chkReadonly->Checked ? "true" : "false");
if(txtUID->Text.Trim().Length() > 0 && txtPWD->Text.Trim().Length() > 0 && chkUseAuth->Checked){
adapter.SetParamValue(selectedModule, "auth users", txtUID->Text.Trim());
//Now save the secret file
AnsiString absoluteSecret = ExtractFilePath(Application->ExeName) + SECRET_DIR;
if(!DirectoryExists(absoluteSecret)){
ForceDirectories(absoluteSecret);
}
AnsiString secretFileName = absoluteSecret + selectedModule + ".secret";
TStringList* sList = new TStringList();
sList->Add(txtUID->Text.Trim() + ":" + txtPWD->Text.Trim());
sList->SaveToFile(secretFileName);
delete sList;
adapter.SetParamValue(selectedModule, "secrets file", GenericUtils::ConvertPathWindowsToCygwin(secretFileName));
}else{
adapter.SetParamValue(selectedModule, "auth users", "");
adapter.SetParamValue(selectedModule, "secrets file", "");
}
adapter.SaveConfig();
txtComment->Modified = false;
txtUID->Modified = false;
txtPWD->Modified = false;
}
示例14: WinMain
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
//除錯用的LOG
TStringList *TempList = new TStringList;
TempList->SaveToFile("runfunction.log");
delete TempList;
//動態產生 Logo Form
Form_Logo = new TForm_Logo(Application);
// Form_Logo->Show();
Application->Title = "FMS Real-Time Monitor";
Application->ProcessMessages();
Application->CreateForm(__classid(TDataModule1), &DataModule1);
Application->CreateForm(__classid(TCallCenter_Main_Form), &CallCenter_Main_Form);
Application->CreateForm(__classid(TCHisTracer), &CHisTracer);
Application->CreateForm(__classid(TForm_Setting), &Form_Setting);
Application->CreateForm(__classid(TForm_Establish_Connect), &Form_Establish_Connect);
Application->CreateForm(__classid(TForm_FreeAll), &Form_FreeAll);
Application->CreateForm(__classid(TForm_ChooseCar), &Form_ChooseCar);
Application->CreateForm(__classid(TForm_CustRoute), &Form_CustRoute);
Application->CreateForm(__classid(TForm_Login), &Form_Login);
Application->CreateForm(__classid(TForm_EditPassword), &Form_EditPassword);
Application->CreateForm(__classid(TForm_ManageState), &Form_ManageState);
Application->ProcessMessages();
Form_Logo->Visible = false;
Form_Logo->Repaint();
Form_Logo->InitApp();
Form_Logo->Hide();
Form_Logo->Close(); //Free Memory in OnClose()
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
return 0;
}
示例15: if
//.........这里部分代码省略.........
MsgDefaultButton = mbOK;
Synchronize(&PostConfirmMessageForm);
delete DataList;
goto LabelTypeMiss;
}
//-----------------------------------
// 復号時のエンコーディング判定
//-----------------------------------
pms->Position = 0;
//DataList->LoadFromStream(pms, TEncoding::UTF8);
DataList->LoadFromStream(pms, TEncoding::GetEncoding(65001));
PrefixString = "Fn_";
for (i = 0; i < DataList->Count; i++) {
if ( DataList->Strings[i].Pos("U_0") == 1){
PrefixString = "U_"; //新バージョン(ver.2.8.0~)で暗号化されているようだ
break;
}
}
// Unicodeではないので従来のShift-JISで再度読み直し
if (PrefixString == "Fn_") {
pms->Position = 0;
DataList->LoadFromStream(pms, TEncoding::GetEncoding(932));
}
//===================================
// デバッグ
//ShowMessage(DataList->Text);
//===================================
#ifdef _DEBUG
DataList->SaveToFile(OutDirPath + ExtractFileName(AtcFilePath) + ".txt");
#endif
delete pms;
//-----------------------------------
// 暗号化ファイルの生成日時
//-----------------------------------
//※特に今は使用していないが、将来的に
// 期限付きでファイルを復号できなくなる
// などの機能を追加しても良いかも。
//-----------------------------------
AtcFileCreateDateString = DataList->Strings[1];
//-----------------------------------
// ヘッダデータからファイルリストや
// ファイル情報などを各変数を動的確保
//-----------------------------------
FileSizeList = new __int64[DataList->Count]; // 1: ファイルサイズ(フォルダは-1)
FileAttrList = new int[DataList->Count]; // 2: 属性
FileDtChangeList = new int[DataList->Count]; // 3: 更新日
FileTmChangeList = new int[DataList->Count]; // 4: 更新時
FileDtCreateList = new int[DataList->Count]; // 5: 作成日
FileTmCreateList = new int[DataList->Count]; // 6: 作成時
DataList->NameValueSeparator = ':';
tsv = new TStringList;
tsv->Delimiter = '\t';
tsv->StrictDelimiter = true;