Y yanghai0437 Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-25 #2 <<左移 >>右移 &与 这个函数就是把zb中的字符串转换后右传出去.
L lsha Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-25 #4 是啊,但是在Delphi中pchar类型的变量好像不能用p1[0],p1[1],p1[2],p1[3]来表示啊, 请各位高手继续关注!!
Y youou Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-25 #5 procedure TForm3.Button1Click(Sender: TObject); var a:Longint; p1char; x:Longint; zchar; begin z:='333'; p1:=@a; x:=(((ord(z[0])-48) shl 2) and $0fc) or (((ord(z[1])-48) shr 4) and $03) ; p1[0]:=chr(x); showmessage(inttostr(x)); showmessage(inttostr(a)); end; 我写了一部分。。试试。。我测试了。。。
procedure TForm3.Button1Click(Sender: TObject); var a:Longint; p1char; x:Longint; zchar; begin z:='333'; p1:=@a; x:=(((ord(z[0])-48) shl 2) and $0fc) or (((ord(z[1])-48) shr 4) and $03) ; p1[0]:=chr(x); showmessage(inttostr(x)); showmessage(inttostr(a)); end; 我写了一部分。。试试。。我测试了。。。
Z zw84611 Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-25 #6 其实PChar可以这样: (p1)^ (p1+1)^ (p1+2)^ (p1+3)^ 明白了?
Z zw84611 Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-25 #7 p1[0],p1[1],p1[2],p1[3]也可以呀,我试了。
L lsha Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-25 #8 to youou:真是太感谢你了,实在是太感谢你了,你帮我解决了两个问题!!!
K KOKS Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-25 #9 function c2i(zbchar ):integer; var a:integer; p1char; begin p1:= @char(a) ; (p1+3)^:=char(((integer(zb^)shl 2)and $fc)or((integer((zb+1)^)shr 4)and $03)); (p1+2)^:= char(((integer((zb+1)^)shl 4)and $f0)or((integer((zb+2)^)shr 2)and $0f)); (p1+1)^:=char( ((integer((zb+2)^)shl 6)and $c0)or(integer((zb+3)^)and $3f) ); p1^:=char(((integer((zb+4)^)shl 2)and $fc)or((integer((zb+10)^)shr 2)and $03) ); result:=a ; end;
function c2i(zbchar ):integer; var a:integer; p1char; begin p1:= @char(a) ; (p1+3)^:=char(((integer(zb^)shl 2)and $fc)or((integer((zb+1)^)shr 4)and $03)); (p1+2)^:= char(((integer((zb+1)^)shl 4)and $f0)or((integer((zb+2)^)shr 2)and $0f)); (p1+1)^:=char( ((integer((zb+2)^)shl 6)and $c0)or(integer((zb+3)^)and $3f) ); p1^:=char(((integer((zb+4)^)shl 2)and $fc)or((integer((zb+10)^)shr 2)and $03) ); result:=a ; end;