Autor Beitrag
Krefti
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 164

Win XP/Vista/Win7/ubuntu
Delphi 7/2006/2009 Pro
BeitragVerfasst: Di 13.09.05 10:02 
hi leutz!

hab mich erst vor kurzem angfange mit Delphi zu beschäftige. jetzt hab ich folgendes problem:
Ich habe primzahlen berechnet und diese in eine binär datei gespeichert, aber ich bekomme es nicht hin sie in einem Memo wieder als zahlen anzeigen zu lassen.
Mein bisheriger Code dazu:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
If radiogroup2.ItemIndex = 1 then
  begin
   
       Assignfile(mybinfile,'U:\Delphi\primzahlendatei\binär.bin');
       reset(mybinfile);
      z:=0 ;
    while not eof(mybinfile) do
    begin
          read(mybinfile,x);
          z:=z+1 ;
     end;
    closefile(mybinfile);
  end;


Kann mir jemand helfen?? vielen dank schon mal!!

Moderiert von user profile iconAXMD: Delphi-Tags hinzugefügt.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 13.09.05 10:05 
Wie schreibst du sie denn rein? Und wie ist mybinfile deklariert? Und warum schreibst du sie nicht einfach als Text in die Datei?
Krefti Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 164

Win XP/Vista/Win7/ubuntu
Delphi 7/2006/2009 Pro
BeitragVerfasst: Di 13.09.05 10:07 
ich schreibe sie auch als textfile, aber des wollte ich zu übungszwecken machen.
der Code mit dem ich sie reinschreib:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
if radiogroup1.itemindex = 1 then
      begin

          System.Assign(mybinFile,'U:\Delphi\primzahlendatei\binär.bin');
          Rewrite(mybinfile)      ;
          For i:=0 to anzahlzeilen-1 do
          begin
            val(memo1.Lines[i],e, Code);
            e:=-1*e;
            write(mybinfile,e)     ;
          end;
          System.Close(mybinfile);
       end;


deklariert ist sie als file of integer

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt.
Krefti Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 164

Win XP/Vista/Win7/ubuntu
Delphi 7/2006/2009 Pro
BeitragVerfasst: Mi 14.09.05 09:23 
hab inzwischen mein problem gelöst... :D