Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Ini - Syntax (https://www.delphipraxis.net/133942-ini-syntax.html)

Razi 12. Mai 2009 14:51


Ini - Syntax
 
Hi Leute,
Hätte eine Frage zu Inis wo ich nicht weiterkomme.
Folgendes Problem:
Ich möchte aus einer Ini einen String auslesen:

..
if FileExists('ferienhaus.ini') then
begin
MyIni := TIniFile.Create('ferienhaus.ini');
Pfad := MyIni.ReadString(??,??,??);
MyIni.Free;
end else
..

In der Ini steht folgendes:
[default]
datadir=G:\

Nun möchte ich gerne wissen was ich in die Klammer beim auslesen für drei Werte schreiben muss,
damit am Ende in 'Pfad' (String) , 'G:\' steht.

Klaus01 12. Mai 2009 14:53

Re: Ini - Syntax
 
.. mal in die Hilfe schauen

Delphi-Quellcode:
Pfad := MyIni.ReadString('default','datadir','');
[ungetestet]

Nachtrag:

Zitat:

Zitat von DelphiHilfe
Retrieves a string value from an INI file.

function ReadString(const Section, Ident, Default: String): String; override;

Description

Call ReadString to read a string value from an INI file. Section identifies the section in the file that contains the desired key. Ident is the name of the key from which to retrieve the value. Default is the string value to return if the:

Section does not exist.
Key does not exist.
Data value for the key is not assigned.

Grüße
Klaus

DeddyH 12. Mai 2009 14:59

Re: Ini - Syntax
 
Hallo und Willkommen in der DP :dp:,

zu Ini-Dateien gibt es hier auch ein Tutorial, falls noch weitere Fragen auftauchen sollten.

Razi 12. Mai 2009 15:05

Re: Ini - Syntax
 
Danke vielmals hat sich aber jetz geklärt :-) wusste nur nich so genau was ich als drittes hinschreiben sollte, aber jetz weiß ichs ja ^^


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:17 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz