Read and write in INI

xiaoxiao2021-03-06  93

Unit unit1;

Interface

Uses

Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, [here must be referred to inIfiles], stdctrls;

Type

TFORM1 = Class (TFORM)

EDIT1: TEDIT;

Button1: tbutton;

Button2: tbutton;

Procedure Button1Click (Sender: TOBJECT);

Procedure Button2Click (Sender: TOBJECT);

Private

{Private Declarations}

public

{Public declarations}

END;

VAR

FORM1: TFORM1;

IMPLEMENTATION

{$ R * .dfm}

Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT);

VAR OK: TINIFILE

Begin

OK: = TiniFile.create ('ok.ini');

Ok.writeString ('form', 'caption', edit1.text);

Ok.Free;

END;

Procedure TFORM1.BUTTON2CLICK (Sender: TOBJECT);

VAR OK: TINIFILE

Begin

OK: = TiniFile.create ('ok.ini');

Form1.caption: = ok.readstring ('form', 'caption', '');

Ok.Free;

END;

End.

转载请注明原文地址:https://www.9cbs.com/read-122243.html

New Post(0)