Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

Inifile

Inifile - Service to manager inifiles data

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

Inifile Service

Inifile - Service to manager inifiles data

Install

Boss install luisnt/Inifile

Sample use

delphi
 
program InifileTest;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils
    , ServiceInifile
    ;

const
  DEFAULT_IP_VALUE   = '127.0.0.1';
  DEFAULT_XPTO_VALUE = 'Default Value';

var
  value: string;

begin
  ReportMemoryLeaksOnShutdown := true;
  try
    value := IniFile.Read('SESSION', 'Property-ip', DEFAULT_IP_VALUE { OPTIONAL } );
    WriteLn('ip: ', value);

    IniFile.Write('SESSION', 'Property-Xpto', 'xpto');
    value := IniFile.Read('SESSION', 'Property-Xpto', DEFAULT_XPTO_VALUE { OPTIONAL } );
    WriteLn('outer value: ', value);

    ReadLn;
  except
    on E: Exception do
      WriteLn(E.ClassName, ': ', E.Message);
  end;

end.
initile

[SESSION]
Property-ip=127.0.0.1
Property-Xpto=xpto