unit iz_inifiles;

interface

type
  TIniFile=class
  private
    FFileName: string;
  public
    constructor Create(FileName: string);
    function ReadInteger(const Section, Ident: string; const Default: Integer): Integer;
    function ReadString(const Section, Ident, Default: string): string;
  end;

implementation

uses
  Windows, iz_utils;

constructor TIniFile.Create(FileName: string);
begin
  inherited Create;
  FFileName:=FileName;
end;

function TIniFile.ReadInteger(const Section, Ident: string; const Default: Integer): Integer;
begin
  Result:=StrToInt(ReadString(Section, Ident, IntToStr(Default)));
end;

function TIniFile.ReadString(const Section, Ident, Default: string): string;
var
  Buffer: array[0..2047] of Char;
begin
  SetString(Result, Buffer, GetPrivateProfileString(PChar(Section),
    PChar(Ident), PChar(Default), Buffer, SizeOf(Buffer), PChar(FFileName)));
end;

end.
