Autor Beitrag
Spurius
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 142

Win XP Home
D3 Prof, D7 Prof
BeitragVerfasst: Sa 12.07.03 12:56 
Hallo,

ich hab eine ini-datei:
ausblenden Quelltext
1:
2:
3:
[profil]
vorname = max
nachname = mustermann

Wenn ich jetzt mit
ausblenden Delphi-Quelltext
1:
vorname1 := ini.readstring(profil,'vorname',???);					

den letzten Wert laden will, funtioniert das nicht. Wie muss ich das schreiben, damit der letzte Wert, der ausgelesen wird?

MfG
Spurius

Moderiert von user profile iconKlabautermann: Code-Tags hizugefügt
Moderiert von user profile iconTino: Delphi-Tags hinzugefügt.
superchatti
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 296

Win XP, Red Hat Linux 7.3
Delphi 6 PE
BeitragVerfasst: Sa 12.07.03 13:04 
Das letze ist der String, der eingesetzt wird falls er die andere nicht finden kann!
Also so:

ausblenden Delphi-Quelltext
1:
vorname1 := ini.readstring(profil,'vorname','');					


Ich hoffe ich konnte helfen!

Moderiert von user profile iconKlabautermann: Delphi-Tags hizugefügt.

_________________
mfG Superchatti
Terra23
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 872

Win 8
Delphi 7
BeitragVerfasst: Sa 12.07.03 13:15 
Trotzdem habt ihr beide einen Fehler. Es muß heißen:

ausblenden Delphi-Quelltext
1:
Vorname1:=Ini.ReadString('Profil''Vorname''');					


"Profil" muß man in Tüttelchen setzen, weil es ein String ist. :-)

_________________
Hasta La Victoria Siempre
superchatti
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 296

Win XP, Red Hat Linux 7.3
Delphi 6 PE
BeitragVerfasst: Sa 12.07.03 14:36 
:oops:
oooops!
Stimmt!

*löl*
Hab ich übersehen :shock:

_________________
mfG Superchatti
Spurius Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 142

Win XP Home
D3 Prof, D7 Prof
BeitragVerfasst: Sa 12.07.03 15:51 
Hallo,
also mit den '' funktionierts bei mir nicht. Hier ist der Code:


ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,inifiles,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  ini:tinifile;
  test:string;
implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
  ini := tinifile.create('c:/testtest');
  test := ini.readstring('profil','vorname','');
  label1.caption := test;
end;

end.

´
Vielleicht weiß da jemand die Lösung. :idea:
MfG
Spurius

Moderiert von user profile iconKlabautermann: Delphi-Tags hinzugefügt
Spurius Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 142

Win XP Home
D3 Prof, D7 Prof
BeitragVerfasst: Sa 12.07.03 15:59 
Hallo,
ich hab den Fehler gefunden. :D
Ich hatte vergessen
ini := tinifile.create('c:/testtest.INI')
zu schreiben. Also die ini-Endung!!
MfG
Spurius
superchatti
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 296

Win XP, Red Hat Linux 7.3
Delphi 6 PE
BeitragVerfasst: Sa 12.07.03 16:23 
-löl-

_________________
mfG Superchatti
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: Sa 12.07.03 19:25 
Hi Leute!

Bitte verwendet in Zukunft die Formatierungsmöglichkeiten, die dieses Boad bietet. Dadurch werden die Beiträge nämlich viel übersichtlicher ;).

Ein einfaches
ausblenden Quelltext
1:
[delphi]Quelltext[/delphi]					

hilft schon sehr.

Gruß
Klabautermann
Simon Joker
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236
Erhaltene Danke: 1



BeitragVerfasst: Mo 14.07.03 09:47 
Am Ende bitte noch  ini.Free; einfügen um den Speicher wieder freizugeben!
foxy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Mo 14.07.03 10:02 
also ich würde das so machen

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
ini:= TINIFile.create;
try
  b:=ini.readstring(xxxxxxxx);
finally
ini.free;

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)