Autor Beitrag
Killmag10
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 297

Suse Linux / DOS / Windows All In One ;)
D4 / D2005
BeitragVerfasst: Mo 28.05.07 17:46 
Hi was mache ich Falsch, ich versuche ein Byte in Boolean einen Array of Boolean umzuwandeln

blos meint der Compiler das es eine ungültige Typenumwandlung währe

ausblenden Delphi-Quelltext
1:
type MyByte = array[0..7] of Boolean;					


ausblenden Delphi-Quelltext
1:
2:
3:
Var
Text1,Text2:string;
MyByte1,MyByte2:MyByte;


und hier krachts
ausblenden Delphi-Quelltext
1:
2:
MyByte1:=MyByte(byte(text1[i]));
MyByte2:=MyByte(byte(text2[i]));


was mache ich falsch ?

mfg. Killmag10

_________________
Mega-inkompetente Computer-ruinierende Organisation spioniert ohne funktionierende Technik
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mo 28.05.07 17:52 
Das geht so nicht. Du kannst nicht einfach ein Byte (Binärdarstellung z.B. 01101001) in ein Array of Boolean konvertieren (hier dann wohl False True True False True False False True). Hauptsächlich deswegen, weil intern ein Boolean eben nicht nur ein Bit belegt.

Du muss dein Array schon per Hand füllen, indem du den Byte-Wert per Hand zerlegst. Der AND-Operator und/oder SHR/SHL dürften dabei hilfreich sein.

_________________
We are, we were and will not be.
Killmag10 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 297

Suse Linux / DOS / Windows All In One ;)
D4 / D2005
BeitragVerfasst: Mo 28.05.07 17:59 
danke

leuschtet ein :idea: , hab nicht daran gedacht das ein Boolean ja nicht nur 1 Bit Belegt, wahr da ihrgentwie im wahn :lol:

_________________
Mega-inkompetente Computer-ruinierende Organisation spioniert ohne funktionierende Technik