Src: array [11] 0.. of Byte;
Put 12 Src digital
How to convert the Numbers one by one in the Src to a string of binary assigned to each
String str0=SRC [0] binary
Strings str1=SRC [1] the binary
,
,
.
CodePudding user response:
Value: the function ByteToBitStr (Byte) : String;
Var
I: Byte;
The begin
Result:='00000000';
If the Value & lt;> 0 then
The begin
For I:=8 downto 1 do
The begin
If Value and (1)=1 then
Result: [I]='1'
The else
Result: [I]='0';
Value:=Value SHR (1);
end;
end;
end;
CodePudding user response:
Var
LStr: AnsiString;
LBytes: Array [11] 0.. of Byte;
LIndex, lSI: Integer;
The begin
LBytes [3] :=66;
LBytes [1] :=2;
LBytes [9] :=89;
SetLength (lStr, Length (lBytes) * 2);
LSI:=1;
For the lIndex:=Low (LBytes) to High (LBytes) do
The begin
Move (AnsiString (IntToHex (lBytes [lIndex])) [1], lStr (lSI), 2);
Inc (lSI, 2);
end;
ShowMessage (lStr);
end;
CodePudding user response: