type
pfile_type=^file_type;
File_Type = record
drive :shortint;
next: pfile_type;
pathname:array[0..511] of char;
iprotype:shortint;
end;
pfile_type=^file_type;
File_Type = record
drive :shortint;
next: pfile_type;
pathname:array[0..511] of char;
iprotype:shortint;
end;
PFile_Type=^File_Type;
File_Type=Record
Driver:ShortInt;
PathName:Array[1..512] of Char;
Next:PFile_Type;
iProType:ShortInt;
End;
1、修改Pathname的定义,改为:PathName:string
2、strPCopy(PathName, edit1.Text);
第二种方法时
strpcopy(node.PathName,edit1.text);
出现如下错误
[Error] Unit1.pas(48): Incompatible types: 'Array' and 'PChar'
如下:
Type
PFile_Type=^File_Type;
File_Type=Record
Driver:ShortInt;
PathName:Array[0..512] of Char;
~~~~~~~~~~
Next:PFile_Type;
iProType:ShortInt;
End;
var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var s:file_type;
begin
strpcopy(s.PathName,edit1.text);
edit2.text:=strpas(s.pathname);
end;