Autor Beitrag
Andy DBase
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 42

win XP Home, win 98SE
D7 Prof
BeitragVerfasst: So 07.03.04 20:04 
Hallo,

ich bin dabei, ein altes DOS-Projekt, welches ich vor ca. 10 Jahren in TurboPascal 7 erstellt habe, nach Delphi 7 zu portieren. Dazu muss ich auch die bisher erstellten Daten übernehmen. Damals hatte ich alles in typisierten Dateien gespeichert.
Nun habe ich ein Kompatibilitäts- Problem bei der Daten- Übernahme. Die (alte) Struktur sieht folgendermassen aus:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
type Ini = Record
           Pfad1:          String[8];
           Nutzer1:        String[15];
           Passwort1:      array[1..8of integer;
           Pfad2:          String[8];
           Nutzer2:        String[15];
           Passwort2:      array[1..8of integer;
           Pfad3:          String[8];
           Nutzer3:        String[15];
           Passwort3:      array[1..8of integer;
           IsHilfe:          Boolean;
           Drucker:        String[15];
           DInit:          String[15];  {Init, Hochformat, A4}
           DLinkerRand:    String[8];   {auf 8}
           D15DPI:         String[8];
           DSchriftart:    String[8];   {Sans Serif}
End;
Das Problem ist, dass ich diese Datei in Delphi nicht einlesen kann, da immer ein Fehler bei der Datensatzgröße auftritt. Ich habe mir nochmal die alten Spezifikationen von TurboPascal 7 angesehen und verwende beim Einlesen anstelle von "Integer" schon "Word" wegen der Typengröße. Trotzdem fehlen mir im Datensatz immer 2-3 Bytes, scheinbar am Ende jedes zweiten oder dritten Strings. Hat jemand einen Tipp/Lösung für das Problem?

mfg, Andy

Moderiert von user profile iconPeter Lustig: Code- durch Delphi-Tags ersetzt
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: So 07.03.04 20:13 
Versuch mal
type Ini = Packed Record
Andy DBase Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 42

win XP Home, win 98SE
D7 Prof
BeitragVerfasst: So 07.03.04 20:28 
Hallo!

Ist ja irre - so eine schnelle Antwort und sooo gut!!! :D Habe plötzlich keine Probleme mehr. Nun werde ich mich noch über die Bedeutung von "packed" schlau machen - die Hilfe weiss da sicher Bescheid...

Vielen Dank, Andy
Brueggendiek
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 304

Win 98, Win98SE, Win XP Home
D5 Std
BeitragVerfasst: So 07.03.04 23:14 
Hallo Andy!

Andy DBase hat folgendes geschrieben:
Ich habe mir nochmal die alten Spezifikationen von TurboPascal 7 angesehen und verwende beim Einlesen anstelle von "Integer" schon "Word" wegen der Typengröße.


Nimm lieber Smallint, denn Word ist ohne Vorzeichen (also nur positive Zahlen). Wenn da negative Zahlen im Record stehen, gibt es sonst komische Effekte!

Gruß

Dietmar Brüggendiek