Unit1.cpp
上传用户:lhxd_sz
上传日期:2014-10-02
资源大小:38814k
文件大小:1k
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include <inifiles.hpp>
- #pragma hdrstop
- #include "Unit1.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TForm1 *Form1;
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button1Click(TObject *Sender)
- {
- TIniFile *ini;
- ini=new TIniFile("my.ini");
- ini->WriteString("sec1","book","red and black");
- ini->WriteInteger("sec2","number",12);
- ini->WriteInteger("sec3","bool",True);
- ini->WriteInteger("sec3","bool1",False);
- delete ini;
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button2Click(TObject *Sender)
- {
- TIniFile *ini;
- ini=new TIniFile("my.ini");
- Edit1->Text=ini->ReadString("sec1","book","1234");
- delete ini;
- }
- //---------------------------------------------------------------------------