Autor Beitrag
theromi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 30.07.07 14:56 
Hi,

Erstmal der betreffende Code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
  AssignFile(datei, 'C:\test.txt');
  Reset(datei);
  
  while not Eof(datei) do
  begin
    Readln(datei, texte);
    if texte[1] = '[' then ShowMessage(texte);
  end;


Das Lustige ist nun, das er eine Zeile normal durchläuft, und dann bei einer Zeile in der nur ein "]" steht die Access violation (at address # in module #. Read of address 00000000.) hat. Ich verstehs einfach nicht :cry:

Danke,
Roman
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 30.07.07 15:04 
Moin und :welcome: im Forum!

Probier das mal so: ;)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
  AssignFile(datei, 'C:\test.txt');
  Reset(datei);
  while not Eof(datei) do
  begin
    Readln(datei, texte);
    if (texte <> '') then
      if texte[1] = '[' then ShowMessage(texte);
  end;

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
theromi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 30.07.07 15:15 
Es geht, Danke :D

Aber warum? In der Datei stehen keine leeren Zeilen, wo liegt der Hase begraben?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 30.07.07 15:18 
Moin!

user profile icontheromi hat folgendes geschrieben:
Es geht, Danke :D

Bitte. ;)

user profile icontheromi hat folgendes geschrieben:
Aber warum? In der Datei stehen keine leeren Zeilen, wo liegt der Hase begraben?

Wenn diese Anweisung das Problem behebt, dann dürfte in der Datei wohl leider doch mindestens eine Leerzeile drin sein... :? :nixweiss:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Mo 30.07.07 15:21 
Reine Spekulation:
Könnte die Unterschiedliche Handhabung des Zeilenumbruchs hier eine Rolle spielen?
(Kombinationen der ASCII Zeichen 10 und 13)

_________________
Delphi: XE - OS: Windows 7 Professional x64
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Mo 30.07.07 16:46 
Nein. In der Datei ist eine Leerzeile, vermutlich am Ende.

_________________
Na denn, dann. Bis dann, denn.