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


C++ TIniFile::ReadString方法代码示例

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


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

示例1: TForm

//---------------------------------------------------------------------
__fastcall TFormMain::TFormMain(TComponent *Owner)
  : TForm(Owner)
{
ProcIndex = -1;
HIDE = 0;
Caption = "Process Monitor";

TIniFile *Ini = new TIniFile( FILE_INI );
if ( Ini == NULL )
  {
  exit(1);
  }

NMUDP1->LocalPort = Ini->ReadInteger( "CONF", "Port", 8081 );

for ( int i = 1; i < 20; i++ )
  {
  String str;
  String section = "PROC";
  section = section + i;
  str = Ini->ReadString( section, "File", "" );
  // remove as plicas "" e outros caracteres do caminho
  str = str.Trim();
  if ( str != "" )
    {
    Processos.push_back( str ); // caminho completo do executável
    Args.push_back( Ini->ReadString(section, "Args", "") ); // argumentos de linha de comando
    Modo.push_back( Ini->ReadInteger(section, "Mode", 0) ); // modo
    WDCnt.push_back(0); // contagem inicial zerada
    WDCntToRestart.push_back( Ini->ReadInteger(section, "RestartCount", 12) ); // tempo para restart
    }
  }

 HIDE = Ini->ReadInteger( "CONF", "Hide", 0 );
}
开发者ID:focusenergy,项目名称:oshmi,代码行数:36,代码来源:proc.cpp

示例2: FormShow

//---------------------------------------------------------------------------
void __fastcall TSocksTestForm::FormShow(TObject *Sender)
{
    TIniFile *IniFile;

    if (!FInitialized) {
        FInitialized = TRUE;
        DisplayMemo->Clear();
        IniFile      = new TIniFile(FIniFileName);
        Width        = IniFile->ReadInteger(SectionWindow, KeyWidth,  Width);
        Height       = IniFile->ReadInteger(SectionWindow, KeyHeight, Height);
        Top          = IniFile->ReadInteger(SectionWindow, KeyTop,
                                            (Screen->Height - Height) / 2);
        Left         = IniFile->ReadInteger(SectionWindow, KeyLeft,
                                            (Screen->Width  - Width)  / 2);
        TargetHostEdit->Text    = IniFile->ReadString(SectionData, KeyTargetHost,    "");
        TargetPortEdit->Text    = IniFile->ReadString(SectionData, KeyTargetPort,    "");
        SocksServerEdit->Text   = IniFile->ReadString(SectionData, KeySocksServer,   "");
        SocksPortEdit->Text     = IniFile->ReadString(SectionData, KeySocksPort,     "1080");
        SocksUsercodeEdit->Text = IniFile->ReadString(SectionData, KeySocksUsercode, "");
        SocksPasswordEdit->Text = IniFile->ReadString(SectionData, KeySocksPassword, "");
        SocksAuthCheckBox->Checked = IniFile->ReadInteger(SectionData, KeySocksAuth, 0);
        Socks4RadioButton->Checked = IniFile->ReadInteger(SectionData, KeySocks4,    0);
        Socks5RadioButton->Checked = IniFile->ReadInteger(SectionData, KeySocks5,    1);
        delete IniFile;
    }
}
开发者ID:halaszk,项目名称:old-delphi-codes,代码行数:27,代码来源:Socks1.cpp

示例3: FormShow

void __fastcall TTestRigMain::FormShow( TObject */*Sender*/ )
{
   StartupTimer->Enabled = true;
   TIniFile * t = new TIniFile( ".\\Configuration\\RigSelect.ini" );
   mfg = t->ReadString( "TestRig", "Manufacturer", "NoMfG" );
   model = t->ReadString( "TestRig", "Model", "NoMoDeL" );
   delete t;
   rig_load_all_backends();

   selected = -1;
   int status = rig_list_foreach( print_model_list, NULL );
   if ( status != RIG_OK )
   {
      return ;
   }
   RigCombo->Sorted = true;

   if ( selected != -1 )
   {
      RigCombo->ItemIndex = RigCombo->Items->IndexOfObject( ( TObject * ) selected );
      RigSelectButtonClick( this );
   }
   else
      RigCombo->ItemIndex = 0;
}
开发者ID:BackupTheBerlios,项目名称:minos-svn,代码行数:25,代码来源:testrmain.cpp

示例4: FormShow

void __fastcall TRigCtlMain::FormShow( TObject */*Sender*/ )
{
   TIniFile * t = new TIniFile( ".\\Configuration\\RigSelect.ini" );
   mfg = t->ReadString( "RigControl", "Manufacturer", "NoMfG" );
   model = t->ReadString( "RigControl", "Model", "NoMoDeL" );
   delete t;
   makeRPCObjects();
   XMPPInitialise( "RigCtl" );
   rig_load_all_backends();

   selected = -1;
   int status = rig_list_foreach( print_model_list, NULL );
   if ( status != RIG_OK )
   {
      char buff[ 1024 ];
      sprintf( buff, "rig_list_foreach: error = %s \n", rigerror( status ) );
      trace( buff );
   }
   RigCombo->Sorted = true;

   if ( selected != -1 )
   {
      RigCombo->ItemIndex = RigCombo->Items->IndexOfObject( ( TObject * ) selected );
      RigSelectButtonClick( this );
   }
   else
      RigCombo->ItemIndex = 0;
}
开发者ID:BackupTheBerlios,项目名称:minos-svn,代码行数:28,代码来源:ctlmain.cpp

示例5: ReadIni

bool ReadIni(char *inifile)
{
   TIniFile tf;
   CSList tmpstr;

   char szBuf[256];
   g_LogFile.Open("bulog");  // 用程序的进程号作为各个BU日志文件存放目录

   memset(&g_BUnit,0,sizeof(g_BUnit));
   printf("Begin to read ini-file:%s...\n",inifile);
   if (!tf.Open(inifile))
   {
      sprintf(szBuf,"不能打开配置文件<%s>\n",inifile);
      //DEBUG_RUNTIME_MSGOUT(szBuf);
      exit(-1000);
   }
   g_LogFile.RemoveOverdueLogFile(tf.ReadInt("COMMON","LOGOVERDUE",10));
   //g_BUnit.iBUnitGourpID = tf.ReadInt("COMMON","GID",1);
   tf.ReadString("COMMON","GID","",g_BUnit.szBUGroupID,sizeof(g_BUnit.szBUGroupID)-1);
   tf.ReadString("BCC","BCCSVR","127.0.0.1:6666",szBuf,sizeof(szBuf)-1);
   if (!tmpstr.FillStrings(szBuf,':') || tmpstr.GetCount()<2)
   {
      sprintf(szBuf,"配置文件<%s>的配置项[BCC] BCCSVR=???? 错误! 格式为:BCCSVR=xxx.xxx.xxx.xxx:port\n",inifile);
      //DEBUG_RUNTIME_MSGOUT(szBuf);
      exit(-1000);
   }
   strncpy(g_BUnit.szSvrIP,tmpstr.GetAt(0),sizeof(g_BUnit.szSvrIP)-1);
   g_BUnit.iSvrPort = atoi(tmpstr.GetAt(1));
   g_BUnit.iHBInterval = tf.ReadInt("BCC","HEARTBEAT",5000);
   if (g_BUnit.iHBInterval<100)
      g_BUnit.iHBInterval = 100;
   tf.Close();
   return(true);   
}
开发者ID:nykma,项目名称:ykt4sungard,代码行数:34,代码来源:ksbu.cpp

示例6: ReadIni_bank

int ReadIni_bank(ST_BANK_CONFIG *p_bankini)
{
	TIniFile tf;
	ST_BANK_CONFIG t_bank;
	char szBuf[256];
	char bank_unit[10]="";
	char * pch;
	int j=0;	
	memset(&t_bank,0,sizeof t_bank);

	if (!tf.Open(TRANS_INI_FILE))
	{
		writelog(LOG_ERR,"Cann't open ini file,file's name=[%s]",TRANS_INI_FILE);
		return -1;
	}
	t_bank.BankCount=tf.ReadInt("COMMON","BANK_UNIT",1);
	t_bank.BCC_BASEFUNCNO=tf.ReadInt("COMMON","BCC_BASEFUNCNO",9000);
	t_bank.DRTP_BRANCH=tf.ReadInt("COMMON","DRTP_BRANCH",7000);
	t_bank.TIMEOUT=tf.ReadInt("COMMON","TIMEOUT",5);
	t_bank.DRTP_PORT=tf.ReadInt("COMMON","DRTP_PORT",4000);
	tf.ReadString("COMMON","DRTP_IP","127.0.0.1",t_bank.DRTP_IP,sizeof(t_bank.DRTP_IP)-1);
	tf.ReadString("COMMON","COMPACC_TIME","06",t_bank.COMPACC_TIME,sizeof(t_bank.COMPACC_TIME)-1);
	tf.ReadString("COMMON","SENDCOMPREQ_TIME","05",t_bank.SENDCOMPREQ_TIME,sizeof(t_bank.SENDCOMPREQ_TIME)-1);
	t_bank.AUTH_MODE=tf.ReadInt("COMMON","AUTH_MODE",1);
	t_bank.LOGIN_MODE=tf.ReadInt("COMMON","LOGIN_MODE",1);
	t_bank.LOG_MODE=tf.ReadInt("COMMON","LOG_MODE",1);
	tf.ReadString("COMMON","SERV_TIME","060000-235959",t_bank.SERV_TIME,sizeof(t_bank.SERV_TIME)-1);
	t_bank.trans_money=tf.ReadInt("COMMON","TRANS_MONEY",100000);
	for(int i=0;i<t_bank.BankCount;i++)
	{
		j=0;
		sprintf(bank_unit,"BANK%d",i+1);
		tf.ReadString(bank_unit,"BANK_IP","26.136.2.9",t_bank.BankUnit[i].szBankIP,sizeof(t_bank.BankUnit[i].szBankIP)-1);
		t_bank.BankUnit[i].iBankID= tf.ReadInt(bank_unit,"BANK_ID",1);
		t_bank.BankUnit[i].iBankPort= tf.ReadInt(bank_unit,"BANK_PORT",5301);
		t_bank.BankUnit[i].iBankTimeout= tf.ReadInt(bank_unit,"BANK_DELAY_TIME",5000);
		t_bank.BankUnit[i].iAuthMode= tf.ReadInt(bank_unit,"AUTH_MODE",1);
		t_bank.BankUnit[i].compare_flag= tf.ReadInt(bank_unit,"COMPARE_FLAG",1);
		t_bank.BankUnit[i].sendcompreq_flag= tf.ReadInt(bank_unit,"SENDCOMPREQ_FLAG",0);
		t_bank.BankUnit[i].compare_count= tf.ReadInt(bank_unit,"COMPARE_COUNT",0);
		tf.ReadString(bank_unit,"BANK_ACCOUNT_NO","2011",t_bank.BankUnit[i].szBankAccountNO,sizeof(t_bank.BankUnit[i].szBankAccountNO)-1);	// 如果是多家银行, 此处需要填写一卡通的银行账户
		tf.ReadString(bank_unit,"BANK_CARD_RANGE","",szBuf,sizeof(szBuf)-1);
		tf.ReadString(bank_unit,"COMPARE_TIME","06",t_bank.BankUnit[i].compare_time, sizeof(t_bank.BankUnit[i].compare_time) - 1);
		tf.ReadString(bank_unit,"SENDCOMPREQ_TIME","05",t_bank.BankUnit[i].sendcompreq_time,sizeof(t_bank.BankUnit[i].sendcompreq_time) - 1);
		tf.ReadString(bank_unit,"COMP_FILE_PATH","/home",t_bank.BankUnit[i].comp_file_path,sizeof(t_bank.BankUnit[i].comp_file_path) - 1);
		pch = strtok (szBuf,",");
		while (pch != NULL)
		{
			des2src(t_bank.BankUnit[i].szBankCardRange[j], pch);
			pch = strtok (NULL, ",");
			j++;
			if(j>=MAX_RANGE) 
				break;
		}
	}
	memcpy(p_bankini,&t_bank,sizeof(t_bank));
	tf.Close();
	return 0;   
}
开发者ID:nykma,项目名称:ykt4sungard,代码行数:59,代码来源:bankguard.cpp

示例7: TIniFile

//---------------------------------------------------------------------------
void __fastcall TForm1::ReadConfig ()    //读取配置
  {
    TIniFile *ini;
    ini = new TIniFile(ChangeFileExt(Application->ExeName,".INI "));
    Form1->Top = ini->ReadInteger( "Form ", "Top ", 100 );
    Form1->Left = ini->ReadInteger( "Form ", "Left ", 100 );
    AnsiString Caption =   ini->ReadString( "Form ", "Caption ", "科传接驳数据合规性检查程序" );
    Form1->Edit1->Text =  ini->ReadString( "Form ", "DefaultDir", "c:\\" );
    delete ini;
   }
开发者ID:rogertl,项目名称:cbuilder,代码行数:11,代码来源:Unit1.cpp

示例8: FormCreate

void __fastcall TMainForm::FormCreate(TObject *Sender) {
    TIniFile *ini = new TIniFile(iniFile);
    try {
        fcPanel->Caption = ini->ReadString("FileName", "file-copy", curDir + "data\\C_wzl");
        cPanel->Caption = ini->ReadString("FileName", "cyclogram", curDir + "data\\CB_4z");
    }
    __finally {
        ini->Free();
        loadAndPrintAll();
    }
}
开发者ID:B-GangsteR,项目名称:opius,代码行数:11,代码来源:Main_Form_Unit.cpp

示例9: LoadFromFile

void TSettings::LoadFromFile(String filename) {
    TIniFile *ini = new TIniFile(filename);

    Fullscreen = ini->ReadBool("Global", "FullScreen", false);
    FormsWidth = ini->ReadInteger("Global", "Width", 1024);
    FormsHeight = ini->ReadInteger("Global", "Height", 1024);
    FormsLeft = ini->ReadInteger("Global", "Left", 0);
    FormsTop = ini->ReadInteger("Global", "Top", 0);
    SoundEnabled = ini->ReadBool("Global", "Sound", false);
    SoundVolume = ini->ReadInteger("Global", "SoundVolume", 100);
	SetVolumeSFX(SoundVolume/100.);
    MusicEnabled = ini->ReadBool("Global", "Music", false);
	MusicVolume = ini->ReadInteger("Global", "MusicVolume", 100);
	SetVolumeMusic(MusicVolume/100.);
    HostMode = ini->ReadBool("Global", "HostMode", false);

    MinWidth = 1024;
    MinHeight = 768;

    for (int i = 1; i <= 5; i++) {
        PlayerNames[i - 1] = ini->ReadString("Players", "Player" + IntToStr(i), "PlayerName");
        PlayerType[i - 1] = (TBotType)ini->ReadInteger("Players", "PlayerType" + IntToStr(i), 0);
    }

    LastBase = ini->ReadString("Global", "LastBase", "");
    if (LastBase == "") {
        if (FileExists("base\\main.dat")) {
            LastBase = "main.dat";
        } else {
            MessageBox(Application->Handle,
                "Ошибка загрузки последней базы вопросов\n" "Попытка загрузить base\\main.dat также провалилась - файла не существует.",
                "Критическая ошибка", MB_OK | MB_ICONSTOP);
            Application->Terminate();
        }
    }

    int i = 0;
    BaseFiles.clear();
    BaseNames = new TStringList;
    while (1) {
        String name = ini->ReadString("Bases", "basename" + IntToStr(i), "");
        String file = ini->ReadString("Bases", "base" + IntToStr(i), "");
        if ((name != "") && (file != "")) {
            BaseFiles[name] = file;
            BaseNames->Add(name);
        } else {
            break;
        }
        i++ ;
    }

    ini->Free();
}
开发者ID:SQReder,项目名称:RussianRoulette,代码行数:53,代码来源:settings_impl.cpp

示例10: TIniFile

//---------------------------------------------------------------------------
void __fastcall TPOP3ExcercizerForm::FormCreate(TObject *Sender)
{
    TIniFile *IniFile;

    IniFile            = new TIniFile(IniFileName);
    HostEdit->Text     = IniFile->ReadString("Data", "Host",     "");
    PortEdit->Text     = IniFile->ReadString("Data", "Port",     "");
    UserNameEdit->Text = IniFile->ReadString("Data", "UserName", "");
    PassWordEdit->Text = IniFile->ReadString("Data", "Password", "");
    delete IniFile;
    InfoLabel->Caption = "";
}
开发者ID:halaszk,项目名称:old-delphi-codes,代码行数:13,代码来源:MailRcv1.cpp

示例11: TForm

// ---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner) : TForm(Owner) {
	TIniFile *Ini = new TIniFile(ExtractFilePath(Application->ExeName) +
		"settings.ini");
	Grid1->Cells[0][0] = "Дата";
	Grid1->Cells[1][0] = "Концентрация";
	Series1->Clear();
	Console->Lines->Add("Программа загружена...");
	Console->Lines->Add("Выбран порт " + Ini->ReadString("Port", "Addr",
		"COM1"));
	Console->Lines->Add("Скорость " + Ini->ReadString("Port", "BaudRate",
		"9600"));

}
开发者ID:AntiPlayerBs,项目名称:Work,代码行数:14,代码来源:main.cpp

示例12: ReadIni

bool ReadIni(char *inifile)
{
    TIniFile tf;
    CSList tmpstr;

    char szBuf[256];
    g_LogFile.Open("bulog");  // 用程序的进程号作为各个BU日志文件存放目录

    memset(&g_BUnit,0,sizeof(g_BUnit));
    printf("Begin to read ini-file:%s...\n",inifile);
    if (!tf.Open(inifile))
    {
        sprintf(szBuf,"不能打开配置文件<%s>\n",inifile);
        DEBUG_RUNTIME_MSGOUT(szBuf);
        exit(-1000);
    }
    g_LogFile.RemoveOverdueLogFile(tf.ReadInt("COMMON","LOGOVERDUE",10));
    //g_BUnit.iBUnitGourpID = tf.ReadInt("COMMON","GID",1);
    tf.ReadString("COMMON","GID","",g_BUnit.szBUGroupID,sizeof(g_BUnit.szBUGroupID)-1);
    tf.ReadString("BCC","BCCSVR","127.0.0.1:6666",szBuf,sizeof(szBuf)-1);
    if (!tmpstr.FillStrings(szBuf,':') || tmpstr.GetCount()<2)
    {
        sprintf(szBuf,"配置文件<%s>的配置项[BCC] BCCSVR=???? 错误! 格式为:BCCSVR=xxx.xxx.xxx.xxx:port\n",inifile);
        DEBUG_RUNTIME_MSGOUT(szBuf);
        exit(-1000);
    }
    strncpy(g_BUnit.szSvrIP,tmpstr.GetAt(0),sizeof(g_BUnit.szSvrIP)-1);
    g_BUnit.iSvrPort = atoi(tmpstr.GetAt(1));
    g_BUnit.iHBInterval = tf.ReadInt("BCC","HEARTBEAT",5000);
    if (g_BUnit.iHBInterval<100)
        g_BUnit.iHBInterval = 100;

    memset(szBuf,0,sizeof szBuf);
    
    // TODO : 加密机配置
    char remoteip[128]={0};
    int remoteport=0;
    tf.ReadString("ENCSVR","ip","",remoteip,sizeof(remoteip)-1);
    BKConfiguration::instance()->save_para("encsvr.remoteip",remoteip);
    remoteport = tf.ReadInt("ENCSVR","port",0);
    BKConfiguration::instance()->save_int_para("encsvr.remoteport",remoteport);

	int mainfunc = tf.ReadInt("ENCSVR","mainfunc",0);
	BKConfiguration::instance()->save_int_para("encsvr.mainfunc",mainfunc);
	int drtpno = tf.ReadInt("ENCSVR","drtpno",0);
	BKConfiguration::instance()->save_int_para("encsvr.drtpno",drtpno);
		
    
    tf.Close();
    return(true);   
}
开发者ID:Codiscope-Research,项目名称:ykt4sungard,代码行数:51,代码来源:ksbu.cpp

示例13: SearchFile

//---------------------------------------------------------------------------
bool __fastcall CIniFile::SearchFile(AnsiString strBarCode,AnsiString &strFileName)
{
  WIN32_FIND_DATA FindFileData;
  AnsiString strName;
  char *pFileName;
  TIniFile *pIniFile;
  bool bResult=false;
  
  strName.sprintf("%s*.ini",IniFile_Dir);
  HANDLE hFile=FindFirstFile(strName.c_str(),&FindFileData);
  if(hFile!=INVALID_HANDLE_VALUE)
  {
    while(FindNextFile(hFile,&FindFileData)!=0)
    {
      pFileName=FindFileData.cFileName;
      strName.sprintf("%s%s",IniFile_Dir,pFileName);
      pIniFile = new TIniFile(strName);
      AnsiString strCode=pIniFile->ReadString(Product_Section,"BarCode","0000");
      delete pIniFile;
      if(strCode==strBarCode)
      {
        strFileName=strName;
        bResult=true;
        break;
      }
    }
    FindClose(hFile);
  }

  return bResult;
}
开发者ID:Raxtion,项目名称:CT82,代码行数:32,代码来源:IniFile.cpp

示例14: LoadFormPos

//---------------------------------------------------------------------------
void __fastcall LoadFormPos(TForm *Form,
                            const AnsiString IniFileName,
                            const AnsiString SectionName,
                            const AnsiString KeyName)
{
    TIniFile   *IniFile;
    AnsiString sWindowPositions;

    if (IniFileName.Length() == 0)
        return;

    // Create inifile object => Open ini file
    IniFile = new TIniFile(IniFileName);

    // Formatage par défaut de la ligne de la section window
    sWindowPositions.SetLength(256);
    WindowPosToStr(sWindowPositions.c_str(), Form);

    // Get widow's position and size from ini file
    sWindowPositions = IniFile->ReadString(SectionName,
                                           KeyName,
                                           sWindowPositions);
    StrToWindowPos(sWindowPositions.c_str(), Form);

    // Destroy inifile object => close ini file
    IniFile->Free();
}
开发者ID:KayvanGuo,项目名称:FTPRipper,代码行数:28,代码来源:OverbyteIcsFormPos.cpp

示例15: LoadConfig

//---------------------------------------------------------------------------
void __fastcall TFtpServerForm::LoadConfig(void)
{
    TIniFile *IniFile;

    IniFile = new TIniFile(FIniFileName);
    FPort   = IniFile->ReadString(SectionData, KeyPort, "ftp");
    IniFile->Free();
}
开发者ID:halaszk,项目名称:old-delphi-codes,代码行数:9,代码来源:FtpSrv1.cpp


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