1
当我运行这个程序帕斯卡尔unhandles出现异常
procedure displaydir;
var count:integer;
directoryfile: file of tdir;
directory:array [1..100] of tdir;
begin
assignfile(directoryfile, 'directory.bin');
reset(directoryfile);
count:=0;
repeat
read(directoryfile,directory[count]);
writeln('Name: ',directory[count].name);
writeln('Telephone number: ',directory[count].tel);
writeln('Job title: ',directory[count].jobtitle);
writeln;
writeln;
count:=count+1;
until (directory[count-1].name = 'q');
end;
我得到的错误
未处理的异常发生在$ 00000000: EAccessViolation:访问冲突 $ 00000000 $ 2A005640 $ B6F83F97
不幸的是,我无法在互联网上找到解决方案,非常感谢帮助!
我不知道你在使用什么Pascal编译器,但你应该打开任何激进的运行时检查,例如[数组范围检查](http://www.freepascal.org/docs- HTML/PROG/progsu65.html)。它会帮助你,直到你拥有你的海腿。而像这样的节目,表现的惩罚是不重要的。 – lurker