F
fridaydream
Unregistered / Unconfirmed
GUEST, unregistred user!
以下是Delphi7 Help中的例程。可为什么编译不通过,很常见的用法啊?
var
F: TextFile;
//编译时为什么总是显示 '.' expected but ';' found?
//不是不说TextFile类型只能用于Console程序,不能用于GUI啊?
//初学请赐教
S: string;
begin
if OpenDialog1.Execute then { Display Open dialog box }
begin
AssignFile(F, OpenDialog1.FileName)
{ File selected in dialog }
Reset(F);
Readln(F, S)
{ Read first line of file }
Edit1.Text := S
{ Put string in a TEdit control }
CloseFile(F);
end;
end;
var
F: TextFile;
//编译时为什么总是显示 '.' expected but ';' found?
//不是不说TextFile类型只能用于Console程序,不能用于GUI啊?
//初学请赐教
S: string;
begin
if OpenDialog1.Execute then { Display Open dialog box }
begin
AssignFile(F, OpenDialog1.FileName)
{ File selected in dialog }
Reset(F);
Readln(F, S)
{ Read first line of file }
Edit1.Text := S
{ Put string in a TEdit control }
CloseFile(F);
end;
end;