关于使用INI文件的问题

void __fastcall TForm1::FormCreate(TObject *Sender)

{
  TIniFile *pIniFile = new TIniFile("c://MyApp//bin//MyApp.ini");
  if (pIniFile->ReadBool("AutoLoad", "FormProperties", false) == true)
  {
    Visible = pIniFile->ReadBool("FormOptions", "Visible", true);
    Color = (Graphics::TColor)pIniFile->ReadInteger("FormOptions", "Color", clWindow);
    Caption = pIniFile->ReadString("FormOptions", "Caption", "Main");
  }
  delete pIniFile;
}
1  #include <IniFiles.hpp>
2  路径不必一定是绝对路径,但一般都把ini文件和可执行文件放一起,定位时方便.
3 ReadString 是读,从ini文件中的一段内读取指定Key的值
Retrieves a string value from an INI file.

virtual AnsiString __fastcall ReadString(const AnsiString Section, const AnsiString Ident, const AnsiString Default);

Description

Call ReadString to read a string value from an INI file. Section identifies the section in the file that contains the desired key. Ident is the name of the key from which to retrieve the value. Default is the string value to return if the:

Section does not exist.
 Key does not exist.
 Data value for the key is not assigned.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值