PASCAL文件操作

来源:百度知道 编辑:UC知道 时间:2024/06/14 19:42:00
我要把文件中的部分数据读出并存入一个新文件中,如何操作?
源文件类型:***.txt
部本内容:(第一行)090101000 57
(第二行)090402000 34
(第三行)090204000 65
说明:前九位数与后两位数中有一个制表符(Tab)。
要求:读出0101 57
0402 34
0204 65
并存入一个新文件中(后缀仍为.txt)。
具体点!

program xxx;
const n=?;
var
a:array[1..n]of string;
i:integer;
begin
assign('xxx.in{如果用turbo pascal的话要写类似于e:\x\xxx\xxxx这样的}',input);
assign('xxx.out{同上}',output);
reset(input);
rewrite(output);
for i:=1 to n do readln(a[i]);
for i:=1 to n do begin
delete(a[i],1,2);
delete(a[i],5,3);
end;
for i:=1 to n do writeln(a[i]);
readln;
close(input);
close(output);
end.

直接把每一行readln进去再writeln在输出上不行吗?
真的不行的话是不是Tab的问题啊,试试repeat read(ch{ch是char型的变量});write(ch);until eof;不知道行不行