Autor Beitrag
achi 3.0
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63



BeitragVerfasst: Mi 25.06.08 09:09 
Hi,


habe folgende Frage. Wie kann ich aus einer Datei einen Bestimmten Wert auslesen. Ich weiß zwar wie ich die ganze datei auslese aber ich brauche nur einen teil.

die datei sieht z.B. so aus:

also das wären die ersten zeilen. ich benötige nur die werte hinter dem gleich..


(**** Konvertiert aus 14244a ***)

(* koo2din.dll from Apr 8 1997 10:33:03 *)
(Modell P1501= 4.0)
(Aler P1534= 210)
(Preis P1535= 1450)


Moderiert von user profile iconNarses: Topic aus VCL (Visual Component Library) verschoben am Mi 25.06.2008 um 17:37
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Mi 25.06.08 09:34 
[Witz]Computer sagt "Nein"[/Witz] (vllt kennt jemand Little Britain) ;-)

Also..mein Programm hat folgende Werte geliefert:

ausblenden Quelltext
1:
2:
3:
4.0
210
1450


So..was genau suchst, bzw. brauchst du jetzt??
Wo hängst du fest?

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Clemens L.
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 158

Win Xp SP3
D6 Enterprise, Turbo Delphi Explorer
BeitragVerfasst: Mi 25.06.08 11:35 
Die Befehle Pos (und PosEx ab Delphi 7), Copy sowie Delete könnten dir da weiterhelfen. Vielleicht auch mal hier nach Suche in: Delphi-Forum PARSENsuchen!


[OffTopic] Little Britain ist super :wink: [/OffTopic]

_________________
Gruß, Clemens
Vor dem 27.04.08 als "hackerTreff" bekannt!
Der nette Nachbar
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 67

Win XP, Suse Linux 9.3
Delphi 7, Delphi 2007, Borland C++ Builder 6, Java Builder 7
BeitragVerfasst: Mi 25.06.08 11:38 
[Anne]Ehhh, Ehhh, Ehhh........I'm in the middle of something, can I call you back? [/Anne]
Boldar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1555
Erhaltene Danke: 70

Win7 Enterprise 64bit, Win XP SP2
Turbo Delphi
BeitragVerfasst: Mi 25.06.08 14:54 
Ich würde in dem Fall eine ini-Datei benutzen. Suche mal unter tinifile!
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Mi 25.06.08 14:58 
Was bringt ihm die INI wenn er die Datei so vorgegeben hat?
Eintragen und wieder auslesen? ;-)

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Boldar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1555
Erhaltene Danke: 70

Win7 Enterprise 64bit, Win XP SP2
Turbo Delphi
BeitragVerfasst: Mi 25.06.08 15:00 
Naja, er erstellt ja die Datei vermutlkich vorher, falls das nicht irgendeine Studiums-Hausaufgabe mit unsinniger Aufgabenstellung ist
achi 3.0 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63



BeitragVerfasst: Do 26.06.08 11:14 
nein ich erstelle die datei leider nicht selber.


habe ein vorhandenes programm was diese dateien erstellt und möchte diese dateien nutzen.

danke
Clemens L.
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 158

Win Xp SP3
D6 Enterprise, Turbo Delphi Explorer
BeitragVerfasst: Do 26.06.08 11:16 
user profile iconClemens L. hat folgendes geschrieben:
Die Befehle Pos (und PosEx ab Delphi 7), Copy sowie Delete könnten dir da weiterhelfen. Vielleicht auch mal hier nach Suche in: Delphi-Forum PARSENsuchen!


Dann ist das was dir weiterhelfen sollte.

_________________
Gruß, Clemens
Vor dem 27.04.08 als "hackerTreff" bekannt!
achi 3.0 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63



BeitragVerfasst: Do 26.06.08 13:12 
wie nutze ich den pos ..... sorry in der hilfe steht nur schmarrrrrn

habe jetzt schonmal das hier, aber es liest nur die erste zeile.

- Problem1 wie kann ich mehrere Zeilen lesen
- Problem2 wie kann ich über pos die position von 'string' rausbekommen
- Problem3 wie kann ich sagen z.B. label1.caption:= ***das was hinter einer bestimmten position steht***

bin für jede hilfe dankbar, habe mir auch ein paar bücher bestellt um auch was selber zu lösen
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
var
   F: TextFile;
   S: string;


begin
    if Opendialog1.Execute then

    begin
    AssignFile(F,OpenDialog1.FileName);

    Reset(F);
    Readln(F,S);


    edit1.Text:=S;
    CloseFile(F);

    end;


Moderiert von user profile iconNarses: Delphi-Tags hinzugefügt
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Do 26.06.08 13:45 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
var F: TextFile;
    S: string;
begin
 if Opendialog1.Execute then
 begin
  AssignFile(F,OpenDialog1.FileName);

  Reset(F);

  //Lies solang, bis die Datei zu Ende ist
  while not eof(F) do
  begin
   Readln(F,S);
   //edit1.Text:=S; //WÜrde jedesmal einen anderen Wert annehmen
  end;

  //Datei wieder schließen
  CloseFile(F);
 end;
end;

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
achi 3.0 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63



BeitragVerfasst: Do 26.06.08 15:09 
danke,


werde mal probieren ob ich damit meine probleme lösen kann.

habe da so ne idee.



gruß achi
achi 3.0 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63



BeitragVerfasst: Fr 27.06.08 15:10 
hi jungs,



kann ich abfragen das kein zeichen vorhanden ist.

damit meine ich z.B. while s='' do und '' heißt leider leerzeichen aber ich meine kein zeichen also a,b,c,d,.......

danke für eure hilfe
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: Fr 27.06.08 21:00 
Hi,

'' =leerer String <> ' '

Im Prinzip solltest du, solange es sich nur um Zahlen handelt, mit einem false als Rückgabewert bei Suche in der Entwickler-Ecke TRYSTRTOFLOAT invalide Eingaben rausfiltern können. Ich frage mich garade, ob ein leerer String als 0 geparst wird :gruebel: Wenn dir das nicht recht ist, solltest du eventuell trotzdem auf '' prüfen.

Auch interessant: Suche in der Entwickler-Ecke STRTOFLOATDEF, gibt bei Fehlschlag einen vordefinierten Wert zurück.

mfG,

_________________
Centaur spears can block many spells, but no one tries to block if they see that the spell is a certain shade of green. For this purpose it is useful to know some green stunning hexes. (HPMoR)
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Fr 27.06.08 21:02 
ich prüfe Strings immer auf Länge > 0

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
if length(String) > 0 then
begin
 //String OK, nicht leer
end
else
begin
 //String ist leer
end;

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.