声明变量
var
f:TextFile;系统提示如下信息:
[Pascal Error] Unit2.pas(1): Unable to invoke Code Completion due to errors in source code请高手指点如何使用TextFile
var
f:TextFile;系统提示如下信息:
[Pascal Error] Unit2.pas(1): Unable to invoke Code Completion due to errors in source code请高手指点如何使用TextFile
解决方案 »
- oracle查询相同字段问题
- dbcombox 为何只能得到一条?
- 请教:WindowsXP下如何隐藏进程?
- 高手帮个忙吧,调试了半天没结果 请看里面的代码
- 学习DELPHI还有必要吗?请介绍一下DELPHI还有多少人用?
- 各位大神,帮我做个个人理财系统,小弟拜谢
- delphi6里的inet6包哪儿有?
- 如何在Form2通过按钮动态创建Form3,然后通过Form3中的按钮关闭Form2
- 用DELPHI怎样控制键盘(方向键,page up,page down,home, end等)
- 高手请赐教:如何用delphi5调用unix平台上的informix数据库?
- 文件操作问题?
- 送份哦,网站重开张
procedure TForm1.Button1Click(Sender: TObject);
var MyFile:TextFile;
s:string;
begin
try
AssignFile(MyFile,'d:\a.txt');
Reset(MyFile);
Memo1.Clear;
while not Eof(MyFile) do
begin
ReadLn(MyFile,s);
Memo1.Lines.Add(s);
end; finally
CloseFile(MyFile);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var MyFile:TextFile;
s:string;
begin
try
AssignFile(MyFile,'d:\a.txt');
Append(MyFile); //或用ReWrite(MyFile),append是不覆盖原文,原文不存在将出错,Rewrite是覆盖原文,文件不存在将创建,
s:='write textfile';
WriteLn(MyFile,s);
finally
CloseFile(MyFile);
end;
end;