发表于:2003-12-15 15:45:00
3楼
Copy() returns a string, not a char; you cannot call ord() in a string. Try the following one...
procedure TForm1.Button1Click(Sender: TObject);
var
st : array[0..100] of char;
i, len : integer;
crc : integer;
begin
strcopy(st, `test`);
len := strlen( st );
crc := 0;
for i:= 0 to len -1 do
crc := crc xor ord(st[i]);
Button1.Caption := IntToHex(ord(crc), 2);
end;