delphi中byte 的赋值(100分)

  • 主题发起人 主题发起人 andrew4031
  • 开始时间 开始时间
A

andrew4031

Unregistered / Unconfirmed
GUEST, unregistred user!
校验密码 密码是:224127
Function PassIcDev() As Integer
Dim Password(2) As Byte
Password(0) = &h22
Password(1) = &h41
Password(2) = &h27
st = csc_4442(icdev, 3, Password(0))
If st < 0 then

'用ffffff校验
Password(0) = &HFF
Password(1) = &HFF
Password(2) = &HFF
st = csc_4442(icdev, 3, Password(0))
Password(0) = &h22
Password(1) = &h41
Password(2) = &h27
st = wsc_4442(icdev, 3, Password(0))
If st < 0 then
PassIcDev = CardErr
else
PassIcDev = CardOk
End If
else
PassIcDev = CardOk
End If
End Function
上面的代码如何在中delphi实现
 
function PassIcDev(): Integer;
var
Password: Array[0..2] of Byte;
begin
Password(0) := $22;
Password(1) := $41;
Password(2) := $27;
st := csc_4442(icdev, 3, Password(0));
if st < 0 then
begin
Password(0) := $22;
Password(1) := $41;
Password(2) := $27;
st = csc_4442(icdev, 3, Password(0));
Password(0) := $22;
Password(1) := $41;
Password(2) := $27;
st = wsc_4442(icdev, 3, Password(0));
If st < 0 then
PassIcDev := CardErr
else
PassIcDev := CardOk;

end
else
begin
PassIcDev = CardOk;
end;
end;
 
Delphi 数组 赋值
用: Password[0] := $22;
而不是: Password(0) := $22;
 
轻问一下数值前加个$是什么意思?
 
后退
顶部