Autor Beitrag
rafi@work
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 147

Win2000 Prof
D7 Enterprise
BeitragVerfasst: Mo 28.07.03 16:37 
Hallo zusammen

Hier lese ich aus einem ini file den Pfad und den Dateinamen eines ini files. nun möchte ich einen bestimmten eintrag auslesen. wie mache ich das? der pfad + dateiname vom ini file wo ich etwas lesen will befindet sich in 'ConfigFilePath'.


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
begin
  if Uppercase(PluginType) = 'TDCSCONNECTIONPLUGIN' then
  begin
    ConfigFilePath := Manager.Configuration.GetString('dcs.ConfigFile');
    ConfigFilePath := utils.CompleteRelativePath(ConfigFilePath);



mfg
Terra23
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 872

Win 8
Delphi 7
BeitragVerfasst: Mo 28.07.03 17:22 
Suche mal nach:

Suche in: Delphi-Forum, Delphi-Library READSECTION
Suche in: Delphi-Forum, Delphi-Library READSECTIONVALUES

Ich denke, das wird dir etwas helfen.. :-)

_________________
Hasta La Victoria Siempre
rafi@work Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 147

Win2000 Prof
D7 Enterprise
BeitragVerfasst: Mo 28.07.03 20:25 
Könntest du mir nicht noch ein Beispiel geben? Wäre sehr froh darüber.

gruss
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Mo 28.07.03 20:45 
Hier ist ein kleines Beispiel, mit dem du alle Sektionen einer Ini-Datei in eine Stringlist einliest.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TForm1.Button1Click(Sender: TObject);
var
  IniFile: TIniFile;
  Liste: TStrings;
begin
  Liste := TStringList.Create;
  IniFile := TIniFile.Create('Datei.ini');
  IniFile.ReadSections(Liste);
  //Liste verarbeiten
  IniFile.Free;
  Liste.Free;
end;


Wenn du eine besondere Sektion haben willst ersetze ReadSections(Liste);
durch
ausblenden Delphi-Quelltext
1:
ReadSection('Name der Sektion', Liste);					

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
rafi@work Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 147

Win2000 Prof
D7 Enterprise
BeitragVerfasst: Mo 28.07.03 21:12 
danke nun ist es aber so, das ich kein ini-file erstellen muss, sondern das file ist schon vorhanden, ich muss nur werte daraus lesen.
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Mo 28.07.03 21:24 
Auszug aus der Delphihilfe:
Zitat:
Create setzt die Eigenschaft FileName und lädt eine Kopie der INI-Datei in eine interne String-Liste im Speicher


Du musst also Create aufrufen, um mit der Ini-Datei zu arbeiten.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
rafi@work Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 147

Win2000 Prof
D7 Enterprise
BeitragVerfasst: Mo 28.07.03 21:28 
hey Doc danke viel mal! :D Mein Abend ist gerettet 8)

greets