在线等候:简单的文件读写问题。
lpa 2003-09-29 10:51:30 我有一个数据文件fex211yd.dat,想把它的数据变成六位(不足六位以空格补齐)
写到文件fex211yd.txt中。但好象程序进入了死循环而使得写出来的文件有几百兆。
请大家看看程序有何错误:
procedure TForm1.Button1Click(Sender: TObject);
var
f,f1:TextFile;
i:Integer;
begin
AssignFile(f,'d:\2004hs\fxx\fex211yd.dat');
AssignFile(f1,'d:\2004hs\fxx\fex211yd.txt');
ReSet(f);
ReWrite(f1);
While not eof(f) do
begin
While not eoln(f) do
begin
Read(f,i);
Write(f1,Format('%6D',[i]));
end;
Write(f1,#13,#10);
end;
CloseFile(f);
CloseFile(f1);
end;