我在UNIT2.PAS中定义了一个函数,我想当unit1.pas调用的时候,传递回去的是一个结构
体的数组。unit2.pas的定义如下:
type
TCode=record
Addr:string;
Code:string;
Source:string;
Byte:integer;
ZhouQi:integer;
Err:string;
end;
function MCode(FileName:string)://在这边如何定义var
DataCode:Array[0..65535] of TCode;想请问:好像是用指针吧,在unit2中的函数应如何定义,
在unit1中我又该如何定义,才能让函数返回的结果为一个结构体的数组。
请尽量写的详细点
体的数组。unit2.pas的定义如下:
type
TCode=record
Addr:string;
Code:string;
Source:string;
Byte:integer;
ZhouQi:integer;
Err:string;
end;
function MCode(FileName:string)://在这边如何定义var
DataCode:Array[0..65535] of TCode;想请问:好像是用指针吧,在unit2中的函数应如何定义,
在unit1中我又该如何定义,才能让函数返回的结果为一个结构体的数组。
请尽量写的详细点
TCode=record
Addr:string;
Code:string;
Source:string;
Byte:integer;
ZhouQi:integer;
Err:string;
end;type ArrCode = Array[0..65535] of TCode;var DataCode: ArrCode;function MCode(FileName:string): ArrCode;implementation{$R *.dfm}function MCode(FileName:string): ArrCode;
begin
Result := DataCode;
end;
{ unit1.pas }uses unit2;procedure TForm1.FormCreate(Sender: TObject);
var DataCode: ArrCode;
begin
DataCode := MCode('');
end;