200 score to sb(200分)

  • 主题发起人 主题发起人 sneer
  • 开始时间 开始时间
S

sneer

Unregistered / Unconfirmed
GUEST, unregistred user!
can u tell me what's wrong with this little program
i want read a file named "tmpfile" and make some change and
write to a file named "gl01.2"

procedure TForm1.Button4Click(Sender: TObject);
var
infile,outfile : textfile;
i,j,n : integer;
outfilename : string;
a : string[200];
ch:char;



begin
outfilename:='gl'+edit_tjno.text+'.2' ;
assignfile(infile,'tmpfile');
reset(infile);
assignfile(outfile,outfilename);
rewrite(outfile);
i:=1;
j:=1;
a[179]:=#13;
a[180]:=#10;
while i>0 do
begin
while j<179 do
begin
read(infile,ch);
a[j]:=ch;
if a[j]<#0 then
begin
i:=-1;
j:=200;
end;
if (a[j]<>#169) and (j=1) then j:=j-1;
if (a[j]=#169) and (j=1) then
begin
j:=j+1;
read(infile,ch);
a[j]:=ch;
if a[j]<>#166 then j:=0;
end;
end;

n:=0;
j:=3;
while j<9 do
if (a[j]>#47) and (a[j]<#58) then
begin
n:=1;
j:=j+1;
end;
if a[68]=#32 then a[68]:=#48;
if a[88]=#32 then a[88]:=#48;
if a[108]=#32 then a[108]:=#48;
if a[128]=#32 then a[128]:=#48;
if a[148]=#32 then a[148]:=#48;
if a[168]=#32 then a[168]:=#48;

if n=1 then
begin
write(outfile,#34);
for j:=3 to 9 do
if a[j]>#44 then
begin
ch:=a[j];
write(outfile,ch);
write(outfile,#34);
write(outfile,#44);
end;
for j:=51 to 69 do
if a[j]>#44 then
begin
ch:=a[j];
write(outfile,ch);
write(outfile,#44);
end;
for j:=71 to 89 do
if a[j]>#44 then
begin
ch:=a[j];
write(outfile,ch);
write(outfile,#44);
end;
for j:=91 to 109 do
if a[j]>#44 then
begin
ch:=a[j];
write(outfile,ch);
write(outfile,#44);
end;
for j:=111 to 129 do
if a[j]>#44 then
begin
ch:=a[j];
write(outfile,ch);
write(outfile,#44);
end;
for j:=131 to 149 do
if a[j]>#44 then
begin
ch:=a[j];
write(outfile,ch);
write(outfile,#44);
end;
for j:=151 to 169 do
if a[j]>#44 then
begin
ch:=a[j];
write(outfile,ch);
write(outfile,#44);
end;
end;
closefile(infile);
closefile(outfile);
end;
end;
end;
 
a:string[200] 改为 a:char[200] 吧
 
a : string[200];
改为:
A : Strings;
 

Similar threads

A
回复
0
查看
1K
Andreas Hausladen
A
A
回复
0
查看
949
Andreas Hausladen
A
A
回复
0
查看
831
Andreas Hausladen
A
A
回复
0
查看
982
Andreas Hausladen
A
后退
顶部