pascal 程序出错 请帮我看看

来源:百度知道 编辑:UC知道 时间:2024/07/03 02:13:07
原代码:

program copytext(input,output,diskfile);
var
diskfile:text;
ch:char;
begin
writeln('Please input text');
writeln;
rewrite(diskfile);
while not eof do
begin
while not eoln do
begin
read(ch);
write(diskfile,ch);
end;
readln;
writeln(diskfile);
end;
writeln;
reset(diskfile);
while not eof(diskfile) do
begin
while not eoln(diskfile) do
begin
read(diskfile,ch);
write(ch);
end;
readln(diskfile);
writeln;
end;
end.

运行 看我空间
http://hi.baidu.com/oysterliu/blog/item/458d1cf680d28724730eec51.html

这是因为你没有指派文件。。
你应该加上assign(diskfile,'XXXX.XX')来指派你要处理的文件。。 如果文件和pascal不在同一个目录下,你还需要指定路径。。