Tmeminifile and Tinifile

Source: Internet
Author: User

In the Inifiles unit, there are three three main operations classes Tcustominifile, Tmeminifile, and tinifile that read the INI file, which, under the Windows System compilation, Tcustominifile are the base classes of Tmeminifile and Tinifile, respectively, The only difference between the two operation classes, Tmeminifile and Tinifile, in the Windows system is that the storage of tmeninifile costs is larger than tinifile. There are several important ways in which tcustominifile

UnitUnit1;InterfaceusesWindows, Messages, sysutils, variants, Classes, Graphics, Controls, Forms, Dialogs, Stdctrls;typeTForm1 =class(Tform)    Button1:tbutton; Button2:tbutton;procedureFormcreate (Sender:tobject);procedureFormdestroy (Sender:tobject);procedureButton1Click (Sender:tobject);procedureButton2click (Sender:tobject);Private{Private declarations} Public{Public declarations}End;varForm1:tform1;Implementation{$R *.DFM}usesInifiles;varIni:tmeminifile;procedureTform1.formcreate (Sender:tobject);beginINI: = tmeminifile.create (' C:\temp\test.ini ');End;WriteprocedureTform1.button1click (Sender:tobject);beginIni. WriteString (' AAA ',' A1 ',' Aaa-string ');All the others are used like IniFile.Ini. Writeinteger ();Ini. Writebool ();Ini. Writedate ();Ini. Writetime ();Ini. Writedatetime ();Ini. Writefloat ();Ini. Writebinarystream ();Ini.  Updatefile; Because Tmeminifile is a memory operation, it can be saved to a fileEnd;read out and otherprocedureTform1.button2click (Sender:tobject);varSstring;beginS: = ini. ReadString (' AAA ',' A1 ',' Default value '); ShowMessage (s);Aaa-stringOther read-in commands are also used in the same way as IniFileIni. Readinteger ();Ini. Readbool ();Ini. Readdate ();Ini. Readtime ();Ini. Readdatetime ();Ini. Readfloat ();Ini. Readbinarystream ();Four other common methods are the same as IniFile.Ini. DeleteKey ();Ini. Erasesection ();Ini. Readsection ();   //ini. Readsections ();    //Three other methods not found in IniFile are also easy to use    //ini. Getstrings (list:tstrings);    //ini. Setstrings (list:tstrings);    //ini. Rename (const filename:string; Reload:boolean);    //The second Boolean parameter in Rename If True will refresh read-in         End ;      procedure  Tform1.formdestroy (sender:tobject);      begin    INI. Free;      end ;      end .              

Tmeminifile and Tinifile

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.