c代码转delphi代码 100分 ( 积分: 100 )

  • 主题发起人 主题发起人 huanghq123
  • 开始时间 开始时间
H

huanghq123

Unregistered / Unconfirmed
GUEST, unregistred user!
char signature[4096];
int signature_length = 4096;
memset(signature, '/0', signature_length);
 
signature: array[0..4095] of Char;
signature_length: smallint = 4096;
FillChar(signature,signature_length,'');
FillChar的第3个参数,我不知道Pascal里'/0'是怎么表示的...
 
signature:array[0..4095] of char;
signature_length:integer;

signature_length:=4096;
fillchar(signature,signature_length,#0);
 
to Hydra0
signature 为什么要从char转为smallint?
 
看错东西...已经修改
 
to maze
#0编译不能通过,应该是什么呀。
 
C里 '/0'是什么意思...
 
0就可以了
 
是空字符,就是占位的。
 
原代码是这样写的
char signature[4096];
int signature_length = 4096;
char *content = NULL;
size_t content_length = 0;
char certificate[4096];
long certificate_length = 4096;
memset(signature, '/0', signature_length);
memset(certificate, '/0', certificate_length);
errorCode = CFCA_VerifySignedDataDetached(
signature,
signature_length,
content,
&content_length,
certificate,
&certificate_length,
verify_handle);



CFCA_VerifySignedDataDetached的定义:
int CFCA_VerifySignedDataDetached(char *signature, long signatureLength, char* originalData, int *originalDataLength, char *certificate, long *certificateLength, HCFCAToolkit toolkitHandle);

求高手帮忙
 
var
signature: array[0..4095] of BYTE;
signature_length: integer = 4096;
content: Pchar;
content_length: integer = 0;
certificate: array[0..4095] of BYTE;
certificate_length: integer = 4096;
verify_handle: HCFCAToolkit
errorCode : integer;
begin
fillchar(signature,sizeof(signature),0);
fillchar(certificate,sizeof(signature),0);
errorCode := CFCA_VerifySignedDataDetached(
Pchar(signature[0]),
signature_length,
content,
@content_length,
Pchar(certificate[0]),
@certificate_length,
verify_handle)

end;
你也可以直接用Pchar类型
 
signature:array[0..4095] of char;
...
//memset(signature, '/0', signature_length);
ZeroMemory(@signature[0],signature_length);
//memset(certificate, '/0', certificate_length);
ZeroMemory(@certificate[0],certificate_length);
{errorCode = CFCA_VerifySignedDataDetached(
signature,
signature_length,
content,
&content_length,
certificate,
&certificate_length,
verify_handle);}
errorCode := CFCA_VerifySignedDataDetached(
@signature[0],
signature_length,
@content[0],
content_length,
@certificate[0],
certificate_length,
verify_handle);


function CFCA_VerifySignedDataDetached(
signature: PChar;
signatureLength: Integer;
originalData: PChar;
var originalDataLength: ShortInt;
certificate: PChar;
var certificateLength: Integer;
toolkitHandle: HCFCAToolkit):ShortInt;
 
to tayu0214
@ 字符编译不过去
 
多人接受答案了。
 
后退
顶部