Z
zyhkernel
Unregistered / Unconfirmed
GUEST, unregistred user!
我写了一段程序:
procedure TForm1.Button1Click(Sender: TObject);
var tempstr:string[8];
myfile:file of string[8];
memostr:string;
begin
if OpenDialog1.Execute then
begin
assignFile(myfile,Opendialog1.FileName);
Reset(myfile);
while not eof(myfile) do
begin
Read(myfile,tempstr)
//编译到这里报错:Incompatible types
memostr:=memostr+' '+tempstr;
end;
memo1.Lines.Add(memostr);
end;
end;
我的文件变量是:myfile:file of string[8],用来读文件的变量也是string[8]类型的,为什么会出现类型不兼容的问题呢?
procedure TForm1.Button1Click(Sender: TObject);
var tempstr:string[8];
myfile:file of string[8];
memostr:string;
begin
if OpenDialog1.Execute then
begin
assignFile(myfile,Opendialog1.FileName);
Reset(myfile);
while not eof(myfile) do
begin
Read(myfile,tempstr)
//编译到这里报错:Incompatible types
memostr:=memostr+' '+tempstr;
end;
memo1.Lines.Add(memostr);
end;
end;
我的文件变量是:myfile:file of string[8],用来读文件的变量也是string[8]类型的,为什么会出现类型不兼容的问题呢?