Autor Beitrag
Der Nekromant
Hält's aus hier
Beiträge: 9

WIN XP (PC), WIN Vista (Laptop)
Delphi 7 Personal
BeitragVerfasst: Sa 06.10.07 14:12 
Hallo Community,

ich habe folgendes vor:

Ich habe mehrere txt-Dateien (nennen wir sie mal T1.txt, T2.txt usw.).

Es soll nun Folgendes geschehen:

Zu Beginn des Programmes und bei jedem Neustart soll der Benutzer wählen, auf welche Datei zugegriffen wird.

Nun möchte ich folgendes wissen:

1. Kann man den Dateinnamen in Variablen ausdrücken, also dass man etwas wie (...\T[k].txt) hat?
2. Kann Delphi feststellen, wie viele Dateien sich in einem Ordner befinden?

Danke im Voraus!

Grüße

Der Nekromant
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 06.10.07 14:14 
1. Ja. Einfach mit Strings zusammenbauen.
2. FindFirst, FindNext, FindClose

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Der Nekromant Threadstarter
Hält's aus hier
Beiträge: 9

WIN XP (PC), WIN Vista (Laptop)
Delphi 7 Personal
BeitragVerfasst: So 07.10.07 10:16 
Hallo BenBE,

danke für deine Antwort!

Deinen ersten Punkt verstehe ich nicht so ganz. Meinst du das so:

ausblenden Delphi-Quelltext
1:
StringList.LoadFromFile('C:\...\T'+inttostr(k)+'.txt');					


Zum Punkt 2: Macht man dann eine repeat-until-Schleife, bis man die letzte Datei gefunden hat (mit inc(x) natürlich)?

Grüße

Der Nekromant
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 07.10.07 10:23 
@1. Jup, genau.

@2.: Schau Dir einfach mal die Beispiele zu den 3 erwähnten Funktionen hier im Forum an, dann solltest Du sehen, was sich da anbietet. Aber im Grunde: Ja.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Der Nekromant Threadstarter
Hält's aus hier
Beiträge: 9

WIN XP (PC), WIN Vista (Laptop)
Delphi 7 Personal
BeitragVerfasst: So 07.10.07 12:01 
Hallo BenBE,

danke, ich werde demnächst damit herumexperimentieren.

Grüße

Der Nekromant