I don't really understand what you are after, and i don't know about pack function but this is some tips about binary.
You didn't tell about the problem directly so i may assume you would actually read the bit states from the string? If that's the case i can show alternative how to read bit states of integer very quickly:
Say we have i1 and i2 variables.
i1 is number that we want to know bit state from
i2 tells which bit we want to read
Code:
procedure TForm1.FormCreate(Sender: TObject);
var i1,i2: integer;
begin
i1:=192; // In bits this means 1100 0000
i2:=128; // In bits this means 1000 0000
if (i2 and i1)<>0 then
caption:='1'
else
caption:='0';
end;
The program will return '1' because both numbers contain at least 1 bit in same position. If i2 was 4 (0000 0100) it would return '0' because 3rd bit in i1 is 0.
Also you can use operators shl and shr to move bits left or right.
Bookmarks