Autor Beitrag
Ulixes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 63

Win Vista Home Premium
Delphi 2009 Professional, XHTML, CSS, PHP
BeitragVerfasst: Fr 24.10.08 13:15 
Hey!!

Ich möchte Zahlen aus einer 2,5 MB großen Textdatei auslesen...

Könnte mir jemand erlären, wie das geht??(bin Anfänger)

Danke im Vorraus!!
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Fr 24.10.08 14:00 
In welchem Format liegen die Zahlen vor?
Sind diese einfach untereinander geschrieben, mit komma getrennt, oder wie oder was?
Und was heißt für dich "auslesen"? Sollen diese in der Software angezeigt werden? TMemo davon die Methode Lines.LoadFromFile
Sollen Sie sonst irgendwie weiter verarbeitet werden?

Brauchen Input...

_________________
PROGRAMMER: A device for converting coffee into software.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19321
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 24.10.08 14:02 
Und was meinst du mit auslesen? Wohin?
(Weiterverarbeiten, einfach nur die Datei anzeigen, Zahlen aus weiteren Daten extrahieren und anzeigen, ...)
Ulixes Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 63

Win Vista Home Premium
Delphi 2009 Professional, XHTML, CSS, PHP
BeitragVerfasst: Fr 24.10.08 20:28 
Die Zahlen liegen als Textdatei und untereinander geschrieben vor.

Des Weiteren sollen die Zahlen in einer TChart-Komponente verarbeitet werden.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19321
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 27.10.08 12:07 
Das reine Auslesen sähe dann zum Beispiel so aus:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
  AssignFile(Datei, ...);
  Reset(Datei);
  while noch Eof(Datei) do
  begin
    ReadLn(Datei, IntVariable);
    // Hier muss die Variable dann verarbeitet werden
  end;
  CloseFile(Datei);
Die TChart-Komponente kenne ich nur vom Namen her, wie du dort etwas einträgst weiß ich nicht. Aber derart viele Werte werden wohl einige Geduld erfordern...

Literatur:
www.delphibasics.co.....asp?Name=AssignFile
www.delphibasics.co.uk/RTL.asp?Name=Reset
www.delphibasics.co.uk/RTL.asp?Name=ReadLn
www.delphibasics.co....L.asp?Name=CloseFile
Ulixes Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 63

Win Vista Home Premium
Delphi 2009 Professional, XHTML, CSS, PHP
BeitragVerfasst: So 02.11.08 15:21 
Bei mir kommt jetzt noch !nach! der Compilierung die Fehlermeldung("Benachrichtigung über Debugger-Exception"), dass eine Exception der Klasse EinOutError mit der Meldung ungültige numerische Eingabe aufgetreten ist.

Die Zahlen liegen so in der Textdatei vor:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
...
5978
5901
5933
5946
5910
5895
5889
...


Mein bisheriger Quellcode:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure einlesen ();                                 // Daten einlesen
var einlesen: TextFile;
    k: integer;
begin
  AssignFile(einlesen,'C:\...' );
  Reset(einlesen);
  while not Eof(einlesen) do
  begin
    ReadLn(einlesen, k);
    form4.series1.add (k);
  end;
  CloseFile(einlesen);
end;
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: So 02.11.08 16:53 
Deklarier k mal als String, statt integer.

_________________
PROGRAMMER: A device for converting coffee into software.
Ulixes Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 63

Win Vista Home Premium
Delphi 2009 Professional, XHTML, CSS, PHP
BeitragVerfasst: Di 04.11.08 17:44 
Gibt es die Möglichkeit/Befehl Zeile einzeln auszulesen??

Quasi eine Nummerierung...
Ulixes Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 63

Win Vista Home Premium
Delphi 2009 Professional, XHTML, CSS, PHP
BeitragVerfasst: Sa 08.11.08 23:07 
Kann sich nochmal jemand meinen Thread anschauen??
DeddyH
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 09.11.08 01:04 
Hab ich getan, aber die Frage nicht verstanden :gruebel:
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19321
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 09.11.08 01:17 
Naja, ich frage mich weniger ob ich die Frage richtig verstehe sondern eher wo das Problem ist. :nixweiss:

Du liest die doch einzeln zeilenweise aus. Und wenn du die Zeilennummer haben willst, dann musst du ja nur eine Integervariable vorher auf 0 setzen und bei jedem Zeilendurchlauf um eins hochzählen.
Ulixes Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 63

Win Vista Home Premium
Delphi 2009 Professional, XHTML, CSS, PHP
BeitragVerfasst: Mo 10.11.08 20:35 
Naja ich habe doch aber keine Integervariable mehr...(die habe ich als String definiert)

Zudem liest er doch solange aus bis die Datei zu Ende ist.
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: Mo 10.11.08 21:03 
Dann deklarier halt ne neue Integer und zählke in der Schleife hoch!!!!
Ulixes Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 63

Win Vista Home Premium
Delphi 2009 Professional, XHTML, CSS, PHP
BeitragVerfasst: Sa 15.11.08 11:13 
Nee, sorry!

Ich habe mein problem falsch geschildert!!

Hab aber schon die Lösung...


Trotzdem VIELEN DANK

Das Forum ist echt genial!