Autor Beitrag
Asgar
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

XP Home Edition
D5
BeitragVerfasst: Mo 30.05.05 10:11 
Hi, hab wieder mal ein kleines Problem.
Hab ein Programm das die Buchstaben in einem string in Binär Code umwandeln soll.
Wie mache ich das am besten?

Mit freundlichm Gruß

Daniel
Heiko
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: Mo 30.05.05 10:24 
ausblenden Delphi-Quelltext
1:
2:
3:
for i:=1 to length(Text: Stringbegin
  ShowMessage(IntToBin(Ord(Text[i])))
 end;


(Nicht getestet)
Asgar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

XP Home Edition
D5
BeitragVerfasst: Mo 30.05.05 10:40 
da kommt ne Fehlermeldung.
[Fehler] Unit1.pas(34): Undefinierter Bezeichner: 'IntToBin'
Heiko
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: Mo 30.05.05 10:41 
Steht bei D6 Prof. aber in der Hilfe drin. Vlt. kennt D5 den Befehl noch nicht. Such mal in deiner Hilfe nach, ob dort der Befehl drin steht.
Asgar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

XP Home Edition
D5
BeitragVerfasst: Mo 30.05.05 10:43 
da steht nix mit bintoint doer inttobin
OneOfTen
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 30.05.05 10:48 
dann musst du dir die funktion inttobin selbst schreiben oder du suchst nach einer im Forum oder bei Google
Heiko
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: Mo 30.05.05 10:52 
Versuche es mal in dem du die Unit IdGlobal einbindest und dann den Befehl aufrufst.
Asgar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

XP Home Edition
D5
BeitragVerfasst: Mo 30.05.05 11:12 
wieder ne Fehlermeldung: [Fataler Fehler] Unit1.pas(7): Datei nicht gefunden: 'IDGlobal.dcu'
Heiko
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: Mo 30.05.05 11:20 
Dann liegt es an D5. Dann mach es so hier:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
type TByteSet: set of 0..7;

var ByteSet: TByteSet;
    Zw: String

for i:=0 to length(Text) do
 begin
  ByteSet:=TByteSet(Ord(Text[i]));
  Zw:='';
  for j:=0 to 7 do //oder for j:=7 downto 0 do kannste auch nehmen. Je na nachdem wierum die Bitreighenfolge sien soll
   begin
    if j in ByteSet then
     begin
      Zw:=Zw+'1'
     end
    else
     begin
      Zw:=Zw+'0'
     end
   end;
 ShowMessage(Zw)
 end;