---
title: "ini-fil"
type: "forum-thread"
url: "https://www.webforum.nu/amne/programmering/78332-ini-fil"
topic: "Programmering"
topic_url: "https://www.webforum.nu/amne/programmering"
author: "msossna"
published: "2003-05-28T13:24:34.000Z"
updated: "2003-06-02T11:38:23.000Z"
replies: 4
views: 283
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/programmering/78332-ini-fil"
---

# ini-fil

## #1 — msossna, 2003-05-28T13:24Z

Hur laddar man lättast info från en ini-fil?
EX. man vill ladda storleken från raden size=

Permalänk: https://www.webforum.nu/p/78332

## #2 — Alpha II, 2003-05-28T18:30Z

Som vanligt är det enklas att kolla i hjälpen ;) Delphi har en mycket bra hjälp.

> This example reads strings in the DELPHI32.INI file and displays them on the form.
> Before you run this example, you must add the IniFiles unit to the uses clause of your unit.
> 
> procedure TForm1.FormActivate(Sender: TObject);
> 
> var
>   DelphiIni: TIniFile;
> begin
>   Canvas.TextOut(20, 10, 'VARIOUS DELPHI SETTINGS');
>   DelphiIni := TIniFile.Create('Delphi32.Ini');
>   with DelphiIni do
>   begin
>     with Canvas do
>     begin
>       TextOut(10, 50, 'Editor Font = ' +
>         ReadString('Editor', 'FontName', 'ERROR'));
>       TextOut(10, 70, 'Search Path = ' +
>         ReadString('Library', 'SearchPath', 'ERROR'));
>       TextOut(10, 90, 'Component Library = ' +
> 
>         ReadString('Library', 'ComponentLibrary', 'ERROR'));
>       TextOut(10, 110, 'VBX Directory = ' +
>         ReadString('VBX', 'VBXDir', 'ERROR'));
>       TextOut(10, 130, 'VBX Unit Directory = ' +
>         ReadString('VBX', 'UnitDir', 'ERROR'));
>     end;
>   end;
> DelphiIni.Free;
> end;

Permalänk: https://www.webforum.nu/p/1066548

## #3 — msossna, 2003-05-28T21:51Z

Hjälpen är bra och stor och halvt hopplös att hitta i :)
Dessutom förstår jag inte exemplet till 100% :q

Permalänk: https://www.webforum.nu/p/1066654

## #4 — Alpha II, 2003-05-28T22:33Z

fil.ini:
\[info\]
size=10

Kod:
uses Inifile;
Procedure ReadIni();
var 
IniFile: TIniFile; 
size: integer;
begin 
IniFile := TIniFile.Create('fil.Ini'); 
size := IniFile.ReadInteger('Info', 'size', 0)); 
IniFile.Free; 
end;

Permalänk: https://www.webforum.nu/p/1066667

## #5 — msossna, 2003-06-02T11:38Z

Tack, nu förstår jag hur det fungerar, det var ju inte så avancerat :)

Permalänk: https://www.webforum.nu/p/1072196

---

Tråden på webben: https://www.webforum.nu/amne/programmering/78332-ini-fil
