assignfile(f1,form1.Edit1.Text);
reset(f1);
assignfile(f2,form1.Edit2.Text);
rewrite(f2); readln(f1,head);
headno:=strtoint(copy(head,1,3));
while not eof(f1) do
begin case headno of
200:
begin
writeln(f2,copy(head,4,length(head)-3));
end ;
210:
begin
writeln(f2,copy(head,4,length(head)-3));
end; end; readln(f1,head);
end;
closefile(f2);
closefile(f1);
//编译没有错误,但是没有结果。
reset(f1);
assignfile(f2,form1.Edit2.Text);
rewrite(f2); readln(f1,head);
headno:=strtoint(copy(head,1,3));
while not eof(f1) do
begin case headno of
200:
begin
writeln(f2,copy(head,4,length(head)-3));
end ;
210:
begin
writeln(f2,copy(head,4,length(head)-3));
end; end; readln(f1,head);
end;
closefile(f2);
closefile(f1);
//编译没有错误,但是没有结果。
你得在while循环中取出headno的值。
reset(f1);
assignfile(f2,form1.Edit2.Text);
rewrite(f2); readln(f1,head);
while not eof(f1) do
begin
headno:=strtoint(copy(head,1,3));//HERE!!!!!! case headno of
200:
begin
writeln(f2,copy(head,4,length(head)-3));
end ;
210:
begin
writeln(f2,copy(head,4,length(head)-3));
end; end; readln(f1,head);
end;
closefile(f2);
closefile(f1);
reset(f1);
assignfile(f2,form1.Edit2.Text);
rewrite(f2); while not eof(f1) do
begin
readln(f1,head);
headno:=strtoint(copy(head,1,3));
case headno of
200:
begin
writeln(f2,copy(head,4,length(head)-3));
end ;
210:
begin
writeln(f2,copy(head,4,length(head)-3));
end;
end;
end;
closefile(f2);
closefile(f1);