当前位置: 首页>>代码示例>>C++>>正文


C++ TStringList::LoadFromFile方法代码示例

本文整理汇总了C++中TStringList::LoadFromFile方法的典型用法代码示例。如果您正苦于以下问题:C++ TStringList::LoadFromFile方法的具体用法?C++ TStringList::LoadFromFile怎么用?C++ TStringList::LoadFromFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TStringList的用法示例。


在下文中一共展示了TStringList::LoadFromFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

/*=============================================================================
*NAME		:main
			:
*MODULE		:Test.cpp
			:
*FUNCTION	:メイン処理関数です
			:
*PROGRAMMED	:Y.Sasai
*HISTORY	:
*ID -- DATE ------- NOTE ------------------------------------------------------
*00 03.02.13 Y.Sasai Ver.0.00 初期作成
*/
int main( int argc, char* argv[] )
{
	TStringList slist;																			// 2003.02.13 Y.Sasai Ver.0.00 StringList.cpp読み込み用
	TStringList ysini;																			// 2003.02.13 Y.Sasai Ver.0.00 YSIniFiles.cpp読み込み用
	TYSIniFile ifile( "test.ini" );																// 2003.02.13 Y.Sasai Ver.0.00 Iniファイルクラス

	slist.LoadFromFile( "q:\\VCTest\\StringList.cpp" );											// 2003.02.13 Y.Sasai Ver.0.00 読み込み
	ysini.LoadFromFile( "q:\\VCTest\\YSIniFiles.cpp" );											// 2003.02.13 Y.Sasai Ver.0.00 読み込み
	ifile.WriteStringList( "StringList.cpp", "Source", slist );									// 2003.02.13 Y.Sasai Ver.0.00 書き込みだ
	ifile.WriteStringList( "YSIniFiles.cpp", "Source", ysini );									// 2003.02.13 Y.Sasai Ver.0.00 書き込みだ
	ifile.UpdateFile();

	return 0;
}
开发者ID:oht,项目名称:VCLibrary,代码行数:26,代码来源:Test.cpp

示例2: LoadTimer

void __fastcall TfrmMain::LoadTimer(TObject *Sender)
{
	LoadSetting();
	if (FileExists(String(LoginerPath) +"\\Data\\"+ GameAccount + "\\Items.dat"))
	{
		TStringList *list = new TStringList();
		list->LoadFromFile(String(LoginerPath) +"\\Data\\"+ GameAccount + "\\Items.dat");
		for (int i = 0; i < list->Count; i++)
		{
			unsigned int ItemID;
			ItemID = _wtoi(list->Strings[i].w_str());
			AnsiString name = String(GetItemName(ItemID));
			if (name.IsEmpty())
			{
				name.sprintf(TEXT("未知物品(編號:%d)"), ItemID);
			}
			int index = list_drop->Items->IndexOfObject((TObject *)ItemID);
			if (index > -1)
				list_drop->Items->Delete(index);
			index = list_filter->Items->IndexOfObject((TObject *)ItemID);
			if (index < 0)
				list_filter->Items->AddObject(name, (TObject *)ItemID);
		}

		delete list;
	}
	Load->Enabled = false;

}
开发者ID:taida957789,项目名称:Deprecated-RwBox-Plus,代码行数:29,代码来源:FormMain.cpp

示例3: TVPGetConfigFileOptions

//---------------------------------------------------------------------------
static TStringList * TVPGetConfigFileOptions(AnsiString filename)
{
	// load .cf file
	AnsiString errmsg;
	if(!FileExists(filename))
		errmsg = "file not found.";

	TStringList * ret = new TStringList();
	if(errmsg == "")
	{
		try
		{
			ret->LoadFromFile(filename);
		}
		catch(Exception & e)
		{
			errmsg = e.Message;
		}
		catch(...)
		{
			delete ret;
			throw;
		}
	}

	if(errmsg != "")
		TVPAddImportantLog(ttstr("(info) Loading configuration file \"") + filename.c_str() +
			"\" failed (ignoring) : " + errmsg.c_str());
	else
		TVPAddImportantLog(ttstr("(info) Loading configuration file \"") + filename.c_str() +
			"\" succeeded.");

	return ret;
}
开发者ID:xmoeproject,项目名称:X-moe,代码行数:35,代码来源:SysInitImpl.cpp

示例4: Read

/*=============================================================================
*NAME		:TYSIniFile::Read
			:
*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::Read( void )
{
	TStringList slist;																			// 2003.02.10 Y.Sasai Ver.0.90 文字列リスト
	int tempi;
	TYSIniSection* ysection;																	// 2003.02.10 Y.Sasai Ver.0.90 セクションクラス
	CString sitem;

	if ( FileName == "" ) {																		// 2003.02.10 Y.Sasai Ver.0.90 ファイル名未設定なら…
		return ( false );																		// 2003.02.10 Y.Sasai Ver.0.90 おわる
	} else if ( FileExists( FileName ) == false ) {												// 2003.02.10 Y.Sasai Ver.0.90 そのファイルがなかったら…
		return ( false );																		// 2003.02.10 Y.Sasai Ver.0.90 おわりだ
	}

	ysection = NULL;																			// 2003.02.10 Y.Sasai Ver.0.90 セクションクラス初期化だ
	if ( slist.LoadFromFile( FileName ) == false ) {											// 2003.02.10 Y.Sasai Ver.0.90 ファイル読み込みエラーなら…
		return ( false );																		// 2003.02.10 Y.Sasai Ver.0.90 エラーだ
	}
	for ( tempi = 0; tempi < slist.Count; tempi++ ) {
		sitem = slist[tempi];
		if ( sitem == "" ) {																	// 2003.02.10 Y.Sasai Ver.0.90 空行なら…
			continue;																			// 2003.02.10 Y.Sasai Ver.0.90 つぎだ
		}
		if ( SectionCheck( sitem ) == true ) {													// 2003.02.10 Y.Sasai Ver.0.90 セクション名なら…
			ysection = Add();																	// 2003.02.10 Y.Sasai Ver.0.90 セクション追加
			ysection->Name = SectionNameGet( sitem );											// 2003.02.10 Y.Sasai Ver.0.90 セクション名設定
		} else if ( ysection != NULL ) {														// 2003.02.10 Y.Sasai Ver.0.90 セクション設定されているなら…
			ysection->Add( sitem );																// 2003.02.10 Y.Sasai Ver.0.90 セクションに追加
		}
	}

	return ( true );																			// 2003.02.10 Y.Sasai Ver.0.90 まあいいでしょ
}
开发者ID:oht,项目名称:VCLibrary,代码行数:49,代码来源:YSIniFiles.cpp

示例5: TStringList

void __fastcall TForm1::FileOpen1Accept(TObject *Sender)
{
String a = FileOpen1->Dialog->FileName;
if (a!=""){
// Öffnen
if (ExtractFileExt(a).UpperCase()!=".AD")a=a.SubString(1,a.Length()-ExtractFileExt(a).Length())+".ad";
TStringList *Liste = new TStringList();
Liste->LoadFromFile(a);

Max = StrToInt(Liste->Strings[0]);
Edit1->Text=Liste->Strings[1];
ListBox1->Clear();
Liste->Delete(0);
Liste->Delete(0);
for (int i=0;i<Max;i++){
ListBox1->Items->Add(Liste->Strings[i*67]);

for (int b=0;b<66;b++){
Data[i][b] = StrToInt(Liste->Strings[i*67 + b + 1]);
}
}
ListBox1->ItemIndex=0;
Selected = ListBox1->ItemIndex;
Load_Dat(Selected);
}
}
开发者ID:tilluhlig,项目名称:LED-Cube-Simulator,代码行数:26,代码来源:Unit1.cpp

示例6: ReadConfig

//---------------------------------------------------------------------------
void TRsyncConfigAdapter::ReadConfig(){

    if(!FileExists(CONFIG_FILE)){
        ShowMessage("Config " CONFIG_FILE " file not found");
        return;
    }


    TStringList* lines = new TStringList();
    lines->LoadFromFile(CONFIG_FILE);


    TModuleHolder* currentModule = new TModuleHolder();
    currentModule->moduleName = GLOBAL_MODULE;
    modules->Add(currentModule);

    for(int i = 0; i < lines->Count; i++){
        AnsiString moduleName = FetchModuleLine(lines->Strings[i]);

        if(moduleName.Length() > 0){
            currentModule = new TModuleHolder();
            modules->Add(currentModule);
            currentModule->moduleName = moduleName;
            continue;
        }

        currentModule->nvp->Add(lines->Strings[i]);
    }

    delete lines;
}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:32,代码来源:RSyncConfigAdapter.cpp

示例7: FormShow

void __fastcall TfMain::FormShow(TObject *Sender)
{
	TStringList* sl = new(TStringList);
	sl->NameValueSeparator = '=';

	TFile f;

	if(f.Exists(ExtractFileDir(Application->ExeName) + "\\Library.lb")){
		sl->LoadFromFile(GetCurrentDir() + "\\Library.lb");

		for(int i = 0; i < sl->Count; i++){
			TListItem* Item = lvLib->Items->Add();
			Item->Caption = ExtractFileName(sl->Names[i]);
			Item->GroupID = 0;
			Item->SubItems->Add(sl->Names[i]); //path [0]

			TStringList* ss = new(TStringList);
			ss->NameValueSeparator = '/';
			ss->Add(sl->ValueFromIndex[i]);

			Item->SubItems->Add(ss->Names[0]); //bookmark [1]
			Item->SubItems->Add(ss->ValueFromIndex[0]); //size [2]

			ss->~TStringList();
		}
	}

	sl->Clear();

	if(f.Exists(ExtractFileDir(Application->ExeName) + "\\Settings.ini")){
		sl->LoadFromFile(GetCurrentDir() + "\\Settings.ini");

		leLogin->Text = sl->ValueFromIndex[0];
		lePass->Text = sl->ValueFromIndex[1];
		if(sl->ValueFromIndex[2] == "1")
			cbRememberPass->Checked = true;
		else
            cbRememberPass->Checked = false;
		leServer->Text = sl->ValueFromIndex[3];
	}

	sl->~TStringList();
}
开发者ID:szavalishin,项目名称:Libs,代码行数:43,代码来源:f_Main.cpp

示例8: OpenFile

void HTMLDocument::OpenFile(const String &filename)
{
	TStringList *sl = new TStringList;
	FileName = filename;
	sl->LoadFromFile(filename);
	browser->OpenFile(filename);
	rcedit->Lines->Clear();
	html = sl->Text;
	rcedit->Text = html;
	setchanged(false);
	delete sl;
}
开发者ID:peleccom,项目名称:kpiapkursach,代码行数:12,代码来源:HTMLDocument.cpp

示例9: THostList

void __fastcall TForm1::FormCreate(TObject *Sender)
{
   AnsiString ip;
   AnsiString hostname;
   int ok;
   int time;
   TPing pi;
   int aa=50;
   grLista= new TList;
   int pos;

   h= new THostList();
   TStringList *TempList = new TStringList;
   TempList->LoadFromFile("pingowaniet.txt");
   for (int i = 0; i < TempList->Count; i++)
   {
     hostname="";
     pos=TempList->Strings[i].AnsiPos(";");
     if(pos>0)
     {
        ip=TempList->Strings[i].SubString(0,pos-1);
        hostname=TempList->Strings[i].SubString(pos+1,TempList->Strings[i].Length()-pos);
     } else
       ip=TempList->Strings[i];
     h->AddHost(ip,hostname);
     // kreowanie wykresu
     gr1=Creategraph(aa);
     grLista->Add(gr1);
     this->InsertControl(gr1);
     aa=aa+127;
   };
   delete TempList;
   incre=0;
   pi.Create();
   for (int i = 0; i < h->Count(); i++)
   {
     ip=h->GetHost(i);
     pi.Ping(ip,ok,time);
     gr1=(TPerformanceGraph *)grLista->Items[i];
     if(ok==0)
     {
       time=9999;
       gr1->DataPoint(clRed,150);
     } else  gr1->DataPoint(clLime,time);
     gr1->Update();
     h->AddHostPingTime(i,time);
   };
   if(h->AnyOutTime())
      TrayIcon1->IconIndex=1;
   else
     TrayIcon1->IconIndex=0;
}
开发者ID:gecko-71,项目名称:ping_panel,代码行数:52,代码来源:Unit1.cpp

示例10: TList

TFastIni::TFastIni(AnsiString FN) :
    m_LastSectionIndex(-1)
{
    m_Sections = new TList();

    TStringList *SL = new TStringList();
    if (FileExists(FN)){
        SL->LoadFromFile(FN);
    }

    LoadFromString(SL);

    delete SL;
}
开发者ID:hkameya,项目名称:Frieve-Editor,代码行数:14,代码来源:utils.cpp

示例11: ShowAboutDemoForm

void ShowAboutDemoForm()
{
  if (FForm == NULL){
	FForm = new TformAboutDemo(Application);
	TStringList *ADescription = new TStringList();
	try{
	  ADescription->LoadFromFile(ExtractFilePath(Application->ExeName) + "About.txt");
	  FForm->Show();
	  FForm->redDescription->Lines->Text = ADescription->Text;
	}
	__finally{
	  delete ADescription;
	}
  }
开发者ID:chinnyannieb,项目名称:Meus-Projetos,代码行数:14,代码来源:AboutDemoForm.cpp

示例12: TForm

//---------------------------------------------------------------------------
__fastcall TEnumWinForm::TEnumWinForm(TComponent* Owner)
  : TForm(Owner)
{
  TStringList *list = new TStringList();
  list->LoadFromFile("winmsgs.txt");
  AnsiString str;
  int k;
  for(int i = 0; i < list->Count; i++)
    {
    str.SetLength(100);
    sscanf(list->Strings[i].c_str(),"%s %X\n",str.c_str(),&k);
    MsgComboBox->Items->AddObject(str,(TObject *)k);
    }
  delete list;
  MsgComboBox->ItemIndex = 0;
}
开发者ID:majioa,项目名称:enumwin,代码行数:17,代码来源:EnumWinUnit.cpp

示例13: ProcessConfigFile

void __fastcall TfmLauncher::ProcessConfigFile()
{
  if (FileExists(ConfigFileName)){
    TStringList *ConfigFile = new TStringList();
    __try{
      ConfigFile->LoadFromFile(ConfigFileName);

      RootDirectory = ConfigFile->Values[cRootDirectory];
      FileName = ConfigFile->Values[cFileName];

      FileName = RemoveTrailingSlash(RootDirectory) + '\\' + RemoveLeadingSlash(FileName);
    }
    __finally{
      delete ConfigFile;
    }
  }
}
开发者ID:chinnyannieb,项目名称:Meus-Projetos,代码行数:17,代码来源:Main.cpp

示例14: ScanAndPrint

void ScanAndPrint(seakgOutput *pOutput, UnicodeString fullname) {
  TStringList *list = new TStringList();  
  list->LoadFromFile(fullname);
  int nCount = list->Count;
  for (int i = 0; i < nCount; i++)
  {
    UnicodeString str = list->Strings[i];
	  if (str.Pos(L"class") > 0 && str.Pos("__declspec") > 0) {
      UnicodeString code = str + "\r\n";
      str = str.Trim();

      UnicodeString uuid = "none";
      if (str.Pos("\"") > 0)
        uuid = str.SubString(str.Pos("\"") + 1, 36);

      UnicodeString interfacename = str.SubString(str.Pos("I"), str.Length() - str.Pos("I") + 1);
      UnicodeString interfacename2 = getName(str);
      bool bStop = false;
      int nIncr = 0;
      while (bStop == false && i < nCount) {
        i++;
        str = list->Strings[i];
        if (str.Pos("{") > 0) {
          nIncr++;
        };

        if (str.Pos("}") > 0) {
          nIncr--;
          if(nIncr == 0) bStop = true;
        };

        code += str + "\n";
      };

	  PrintDoc(pOutput, fullname, interfacename2, uuid, code);
//      std::wcout << str.c_str();
    };
  };



  /*std::wcout << "createuuidprojectname: " <<  << "\r\n";
  std::wcout << "projectname: " << projectName.c_str() << "\r\n";
  std::wcout << "fullname: " << fullname.c_str() << "\r\n";*/
};
开发者ID:sea-kg,项目名称:seakgChrysocyonParser,代码行数:45,代码来源:main.cpp

示例15: GetServerIP

String GetServerIP()
{
	TStringList *list = new TStringList;

	if (FileExists(ExtractFilePath(Application->ExeName) + "\\ip.txt")) {
		try {
			list->LoadFromFile(ExtractFilePath(Application->ExeName) + "\\ip.txt");
			return list->Strings[0];
		} catch (...) {
			ShowMessage("Ошибка! Не верный ip-адрес сервера.");
			delete list;
			return "localhost";
		}
	}
	else
		return "localhost";

}
开发者ID:IshPeredysh,项目名称:udd2,代码行数:18,代码来源:MainUnit.cpp


注:本文中的TStringList::LoadFromFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。